OJ Develops

Thoughts on software development. .NET | C# | Azure

Resetting the Primary Key of a Table

14 May 2013

Resetting the Primary Key of a Table thumbnail

This quick tip will show how to reset the primary key values for a table in SQL Server:

DBCC CHECKIDENT ([Table], RESEED, [NewCurrentValue])

Where [Table] is the table name and [NewCurrentValue] is the new current value of the id. This would ideally be set to 0, so that the next value (when a row is inserted) will be 1.