img.simone
img.simone

Reputation: 742

Return to 1 from autoincrement database field

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?

Upvotes: 2

Views: 65

Answers (1)

AHiggins
AHiggins

Reputation: 7219

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

Upvotes: 1

Related Questions