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

Reset AutoNumbering

Status
Not open for further replies.

lifegard2

IS-IT--Management
Mar 28, 2002
250
US
I am fairly new to SQL Server, so bear with me.

I just deleted all data from a table and now need to reset the autonumber field. Any ideas?
 
One way would be to delete the autonumber field in table design, save the table design, recreate the autonumber field. Hope this helps.
 
Use DBCC CHECKIDENT.

Example from SQL BOL: Reset current identity to 30 in jobs table
USE pubs
GO
DBCC CHECKIDENT (jobs, RESEED, 30)
GO

Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions.
 
I tried that in SQL Server 7, and it gave me a DBCC error about the arguments. Should this work in 7? Thanks in advance.
 
Terry,

I like the DBCC CHECKIDENT feature. Can't you reset the autonumber field by truncating the table? -----------------------------------------------------------------
DIM bulb
SET bulb = NEW brain

mikewolf@tst-us.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top