RSS Links

 

Here are all of the RSS links for sections of this site

VB.NET/ASP.NET
 Java
 Unix/Linux
 Windows
 SQL Server

Home arrow SQL Server arrow Commands for managing identity columns in SQLServer
Commands for managing identity columns in SQLServer PDF Print E-mail
Wednesday, 31 December 2008

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

 
< Prev   Next >
 
Designed by Graham Robinson Software