T-SQL – How to reset auto increment to 1

The following T-SQL shows how to reset a tables identity auto increment back to 1.

This may be useful if you have cleared all data from a table and want new data to start at 1.

Important: only run this command if the table is empty – running this on a populated table will result in insert errors.

ALWAYS BACKUP before running bulk action commands.

DBCC CHECKIDENT ( Name_Of_Table, RESEED, 0 )

Was this article helpful?

Related Articles