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 2000 Forums
 Transact-SQL (2000)
 Auto number (unique ID) population

Author  Topic 

SQLvoodoo
Starting Member

4 Posts

Posted - 2007-04-19 : 11:29:06
I have a table with over 400K records that is in desperate need of a unique identifier. I added the unique ID field to my DB, but all existing records are set at NULL for a unique ID and my next input is where the unique ID will start (at 1)... is there a way to populate the existing records with a value and then have the count pick up at let's say 400,001?

Thanks for any help

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-04-19 : 11:32:00
you can add the column with identity property


alter yourtable add [ID] int identity(1,1)


the existing record will be assign identity value of 1 to 400K


KH

Go to Top of Page

SQLvoodoo
Starting Member

4 Posts

Posted - 2007-04-19 : 16:22:56
thanks!
Go to Top of Page
   

- Advertisement -