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
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 Change starting number to a auto numbered field.

Author  Topic 

taunt
Posting Yak Master

128 Posts

Posted - 2011-01-10 : 11:54:26
Hello, how do I Change the starting number to a auto numbered field in sql? Say the table is items, and I need to change it to start at 40,000. What would be that correct command.

Thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-01-10 : 11:57:45
you need to create an identity column in table and set the seed value as 40000. it will be like

ALTER TABLE Items ADD ID int IDENTITY(40000,1) NOT NULL


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2011-01-16 : 17:54:57
DBCC CHECKIDENT('Table1', RESEED, 39999)



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -