Reply to Re: can i increment the column (c1+2) ---by creating the trigger

Your name:

Reply:


Posted by Jack Vamvas on 03/10/06 09:18

You could try

DECLARE @lastNum INT
SET @lastNum = (SELECT TOP 1 ISNULL(b,0) + 1 FROM ddd ORDER BY b DESC)
insert into ddd (a,b)
values(2,@lastNum)


--
Jack Vamvas
___________________________________
Receive free SQL tips - www.ciquery.com/sqlserver.htm

"satish" <satishkumar.gourabathina@gmail.com> wrote in message
news:1141969999.103702.215120@v46g2000cwv.googlegroups.com...
> hi,
> i am a beginner to ms sql server2000
> i have a table
> create table ddd (a int, b int)
> by table structure is a b
> now when i enter a value in b column suppose '2' in column b
> bext time when i insert a value in the column a i have to get the value
> in b as 3 is thi spossible with triggers
>
> insert into gdg values (1,2)
> a b
> 1 2
> insert into gdg (a) values(2)
> a b
> 2 3----------------> i have to get this 3 automatically
>
> is there any method to get this
>
> pls help me
>
> satish
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация