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 danielledunham on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ReNumerate an Identity Seed

Status
Not open for further replies.

JayKusch

MIS
Joined
Oct 30, 2001
Messages
3,199
Location
US
Morning Folk...

I have a temp table w/ and Identity set on it. After processing, adding/deleting records, I want to reset the Identity so that the identity is uniform. I thought DBCC CheckIdent would have done the trick BUT I have yet to get it working.
Thanks

J. Kusch
 
What do you mean by "uniform"? Do you mean the updates you make result in gaps in the identity field, eg 1,2,5,6,7,11 etc.. and you want to get rid of them?

If so then you can't do this with a single command, You could create a new temp table with an IDENTITY column and INSERT the data into that. --James
 
Hi,

If u want ur identity to be reset to 1 try this

DBCC CHECKIDENT (#t, RESEED, 0)

and also if u r deleting all the records from the table use truncate instead of delete to reset the identity values.

Sunil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top