Reseeding autonumber columns in SQL Server

BronwenWeeGo.jpgHere’s one I always have to look up. You’ve cleared out all the data in your tables and you want to set the autoid back to the beginning…or you want to start it at a particular number. DBCC CHECKIDENT is the command for you.

E.g.

command signature: DBCC CHECKIDENT(table_name, RESEED, new_value)
usage: DBCC CHECKIDENT(Customers, RESEED, 0)