Friday, December 13, 2013

Reset Identity

DBCC CHECKIDENT can reseed (reset) the identity value of the table. For example, YourTable has 25 rows with 25 as last identity. If we want next record to have identity as 35 o Run following T SQL script in Query Analyzer.
DBCC CHECKIDENT (‘table_name’, reseed, 34)
If identity seed is set below values that currently are in table, it will violate the uniqueness constraint as soon as the values start to duplicate and will generate error.

No comments: