How do I reset the Autonumber to Zero in MSSQL
Question:
You have designed your database and populated it with test data and it is all working fine. It is time to go live and you delete the test data and are ready to go live.
You go live and when you see the live data going into your database the live auto number (@@IDENTITY) starts at the end of the last test number.
No Panic... just use the following in Query Analyzer
Answer:
USE databasename
GO DBCC CHECKIDENT (tablename, RESEED, 1)
Go Read all about it at MS: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_dbcc_5lv8.asp
Comments
reset auto-nr in Access
Once you delete all your records in Access, switch to design view and turn off the autonumber and remove the key, now close design view and save changes. Then switch back in design view and turn auto-nr and key back on and your auto-nr has been reset.
Dennis
You must me logged in to write a comment.