Monday, April 25, 2011

SQL Table Reseeding

For Reseeding an Identity column use this statement.

DBCC CHECKIDENT (Employee, RESEED, 0)
Employee is the TABLE NAME. After the execution of this statement identity value will start from 1...

if you want to start from 11, execute statement like
DBCC CHECKIDENT (Employee, RESEED, 10)


DBCC means Database Console Commands.
this command statements are grouped in to several categories

  • Maintenance statements - Maintenance tasks on a database, index, or filegroup.
  • Miscellaneous statements - Miscellaneous tasks such as enabling row-level locking or removing a dynamic-link library (DLL) from memory.
  • Status statements - Status checks.
  • Validation statements - Validation operations on a database, table, index, catalog, filegroup, system tables, or allocation of database pages.

For more info
1. http://msdn.microsoft.com/en-us/library/aa258281(v=sql.80).aspx
2. http://msdn.microsoft.com/en-us/library/aa258817(v=sql.80).aspx

No comments:

Post a Comment