EXEC sp_msforeachtable @command1 = 'DBCC CHECKIDENT (''?'', RESEED)'
This will get the highest record ID for each table and reset the identity seed to one number higher.
It will display any error for any table that does not have an identity column.
To do only one table you can run this:
DBCC CHECKIDENT ('tablename', RESEED)
To see what the current seed is:
DBCC CHECKIDENT ('tablename', NORESEED)
No comments:
Post a Comment