Sunday, April 29, 2012

Reset Identity column in SQL Server

If you have deleted all records in your table and you want to start new identity value from 1 then you need to run below command
 
The following line resets the Identity value for the Employee table to 0 so that the next record added starts at 1.

DBCC CHECKIDENT('Employee', RESEED, 0)

Also, there are 40 records in your table and you want to start next record from 51 then you need to run below command

DBCC CHECKIDENT('Employee', RESEED, 50)