-- Check Current Identity Seed
DBCC CHECKIDENT ('tbTable01', NORESEED);

-- Reseed Identity Column
DBCC CHECKIDENT ('tbTable01', RESEED, 1001)

The seed is good if the current identity value is equal to or greater than the current value.

Checking identity information: current identity value '1033', current column value '1033'.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.

Note:

  • If you are using SQL Compare to update table, don’t run the RESEED statement.
  • May have to run the reseed statement multiple times if there are already data rows with the existing seed.
DBCC CHECKIDENT ('tbTable01', RESEED, 1025)
DBCC CHECKIDENT ('tbTable01', RESEED, 1025)

Sources:

https://docs.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-checkident-transact-sql?view=sql-server-ver15

Last modified: September 15, 2020

Author

Comments

Write a Reply or Comment