Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 automatically increment a field value

Author  Topic 

zizou147
Starting Member

2 Posts

Posted - 2008-09-11 : 06:57:01
hi guys ,I want to know how to incremnt a filed value automatically once a record is added to the table ,thx.

Vadivu
Starting Member

31 Posts

Posted - 2008-09-11 : 07:05:42
do u mean incrementing the primary key? while creating table, use this following [column name] [int] IDENTITY(1,1) NOT NULL. hope i got it right.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-09-11 : 07:06:02
Cant you make use of identity column?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-09-11 : 07:06:54


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

zizou147
Starting Member

2 Posts

Posted - 2008-09-11 : 07:08:16
yes it's the PK ,thx for your help guys.
Go to Top of Page
   

- Advertisement -