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
 Getting sequence number generations

Author  Topic 

vanisudha2000
Starting Member

2 Posts

Posted - 2006-05-31 : 13:40:50
I am newbie to SQL Server 2005.

Can any experts please give me code for how to generate automatic sequence numbers in sql server 2005?

I want to use this generated sequence number as a primary key to update the records.

Thanks in advance,
Vani

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-05-31 : 13:42:33
CREATE TABLE Table1 (Column1 int IDENTITY(1, 1), Column2 varchar(50), ...)

You just need to use the IDENTITY option for that column.

Tara Kizer
aka tduggan
Go to Top of Page

vanisudha2000
Starting Member

2 Posts

Posted - 2006-05-31 : 14:42:48
Thanks. I tried and it's working fine.
Go to Top of Page
   

- Advertisement -