SQL Server: Script to reset Table Identity using DBCC CHECKIDENT

In this post, I provide one important DBCC command to reset or change the current value of Table Identity.
I have found that this is a most popular questions from SQL Server Professional so I am also interested to write 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 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 this command to perform this exercise.

After executing this command, you will find next inserted id is:302.

You can find more details on Microsoft Official Page.

Anvesh Patel

Leave a Reply

1 Comment on "SQL Server: Script to reset Table Identity using DBCC CHECKIDENT"

Notify of
Sort by:   newest | oldest | most voted

I like the helpful information you provide in your articles.
I will bookmark your weblog and check again here regularly.

I’m quite certain I will learn many new stuff right here!
Best of luck for the next!