Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Identify Seed

Status
Not open for further replies.

Hackster

Programmer
Mar 28, 2001
173
US
How can I programmaticly reset a SQL Server IDENTITY_SEED?

I've been looking through the help and searching online SQL Server web sites and haven't come up with anything. The only way I've been able to get reset it is to delete all the records, modify the table so that it doesn't have an identity, save the table, modify the table again puting the identity back. That's not only a pain, but hardly something I want to have to do all the time.

Suggestions?
 
Check out DBCC CHECKIDENT.

Of course if you have existing records, you can reset to 1, but the next value will still be the one after the value in the last record.

Questions about posting. See faq183-874
 
Thank you SQLSister, I will check that out. In fact, I kind of had a feeling that even if there was a way, I would still wind up, after the reset, with my second record being seeded with the number after my last record before the seed reset.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top