Reset indentity value of Auto increment Key to 0 in SQL server 2008

I have been searching for resetting the Auto increment value of ID Column in MSSQL Server 2008 and finally solved the problem. You can simply do the following in SQL.

The following line resets the Identity value for the ‘MyTable’ table to 0 so that the next record added starts at

DBCC CHECKIDENT(‘MyTable’, RESEED, 0)

The truncate command can also does the trick but its not applicable if there are some foreign key constraints.

For more information on DBCC CHECKINDENT you can refer MSDN.http://msdn.microsoft.com/en-us/library/ms176057.aspx

SHARE Reset indentity value of Auto increment Key to 0 in SQL server 2008

You may also like...

Leave a Reply

Your email address will not be published.

Share