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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Auto number (unique ID) population
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

SQLvoodoo
Starting Member

4 Posts

Posted - 04/19/2007 :  11:29:06  Show Profile  Send SQLvoodoo a Yahoo! Message  Reply with Quote
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)

Singapore
17689 Posts

Posted - 04/19/2007 :  11:32:00  Show Profile  Reply with Quote
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 - 04/19/2007 :  16:22:56  Show Profile  Send SQLvoodoo a Yahoo! Message  Reply with Quote
thanks!
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000