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:


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.

How useful was this post?

Click on a star to rate it!

Average rating / 5. Vote count:

Leave a Reply

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

%d bloggers like this: