This article is half-done without your Comment! *** Please share your thoughts via Comment ***
In this post, I am sharing an important DBCC command to reset or change the current value of Table Identity Column in SQL Server.
I found that this is a most famous question from SQL Server Professional, so I am also interested in writing a small note on this.
Using DBCC CHECKIDENT, you can reseed the identity value of the table.
For example, Your table has total 268 rows, and the last id is 268 and now if you want to skip some identity values for the next couple of insertion and require next id value as a 302.
You can use below the command to perform the above exercise.
1 |
DBCC CHECKIDENT (yourtable, reseed, 301) |
After executing the above command, you will find next inserted id is:302.
You can find more details on Microsoft Official Page.