Return to 1 from autoincrement database field

76 Views Asked by At

Using SQL Server, I've got a column "ID" in my table that auto-increments every time I insert a new record.

How can I reset this counter and return to 1?

1

There are 1 best solutions below

0
On BEST ANSWER

If you are SQL Server, and assuming your ID column uses the IDENTITY() property, you need to use the DBCC CHECKIDENT syntax:

USE MyDatabase
GO

DBCC CHECKIDENT ('myschema.MyTable', RESEED, 1); 
GO