This neat little SQL Server statement allows you to view/edit properties of the identity value of a table.
Syntax: DBCC CHECKIDENT ('table_name' [ , { NORESEED { RESEED [ , new_reseed_value ] } } ])[ WITH NO_INFOMSGS ]
For example, if I want to reset the identity value of the table FOOBAR to 55, I run the following SQL statement:
DBCC CHECKIDENT('FOOBAR', RESEED, 55).
If FOOBAR already has rows, the next row's identity field will take on the value 56. If FOOBAR is an empty table, its first row's identity field will take on the value 55.
Neat-o.
Monday, November 20, 2006
Subscribe to:
Post Comments (Atom)
1 comment:
Forgot to add a link to the Microsoft documentation (SQL Server 2005 edition).
Post a Comment