Sunday, July 28, 2013

SQl Server- Reset Identity Column in SQL Server



 

The following line resets the Identity value for the table so that the next record added starts at your specified seed value.



DBCC CHECKIDENT (yourtable, RESEED, reseedvalue)
--For Example
DBCC CHECKIDENT(' MyTestTable', RESEED, 0)

 Either you have to delete all the records already existing in the table or else the Rseed Value should be greater than the max. of already existing values.

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More