Reset table auto increment column in ms sql server

Reset table auto increment column in ms sql server

If we want to reset the auto increment value of any table to any other value than default value, we need to use DBCC query.

To use DBCC query you must open sql server management studio with Administrator permission.

Check the below query:

DBCC CHECKIDENT(‘tblUser, RESEED, 1000)

CHECKIDENT accepts multiple parameters and here we pass three parameters as shown in the example. First parameter is the name of the table and second is to indicate where the table is to reseed or noreseed and the third parameter accept the reset value of the column.

If the default value of the tablUser having autoincrement column userid is 6(say), then after executing the above query the autoincrement value will be reseeded to 1000 and next value will be 1000 when new entry will be inserted.

4 Replies to “Reset table auto increment column in ms sql server”

  1. gmail.com login

    Hello!!! My name is Elinor. I live in Gfohl. I have read this blog
    post about Reset table auto increment column in ms sql server – Sweksha and want to
    thank you for such an informative article.

Leave a Reply

Your email address will not be published. Required fields are marked *