Reset or Set the value of the auto increment index in SQL Server

If an auto incremented index is defined in a table, then when we delete all the data from this table, the new values of the “id” column are incremented from the last inserted value event if it is no longer in the table.

What if we copy a database and there is a requirement to keep the “id” column identical?

Then we use this command:

DBCC CHECKIDENT (tableName, RESEED, newValue)

Post a Comment

Previous Post Next Post