Resetting the Primary Key of a Table

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.

Popular posts from this blog

Vertical Slices Application Design with MediatR: Part 2

Deploying a Web Application to Local IIS using Visual Studio 2017

Login with AngularJS and ASP.NET Web API