|
DBCC CHECKIDENT
There are a few options that you can use for this command:
The first option will show you the current value of the identity column without affecting the value.
DBCC CHECKIDENT ('table_name', NORESEED)
Checking identity information: current identity value '14', current column value '14'.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
This next option will reset the next identity value if it is needed.
DBCC CHECKIDENT ('table_name', RESEED)
Checking identity information: current identity value '14', current column value '14'.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
This last option will reset the identity starting with the value that you provide.
DBCC CHECKIDENT ('table_name', RESEED, new_reseed_value)
Checking identity information: current identity value '14', current column value '30'.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
Thanks to Edgewood Solutions Engineers from MSSQLTips for this one - more information at http://www.mssqltips.com/tip.asp?tip=1123
|