Reseed an Identity Column
Sometimes identity columns must be reseeded. A good example is when merging data from a couple of different data sources. There is a DBCC command that makes this task easy.
DBCC CHECKIDENT (<table name>, RESEED, <new value>
To find what existing identity column values are, a simple query can be written off the sys.identity_columns system view.
DBCC CHECKIDENT (<table name>, RESEED, <new value>
To find what existing identity column values are, a simple query can be written off the sys.identity_columns system view.
SELECT OBJECT_NAME(object_id) AS [Table],
[name] AS [column],
seed_value,
last_value
FROM sys.identity_columns
ORDER BY 1


Comments