Reseed the identity on a SQL Server table

I’d rather just take the identity off the table I had to use this on, but this is an excellent solution if you over incremented the identity and need to bring it back.

Amplify’d from msdn.microsoft.com

The following example forces the current identity value in the AddressTypeID column in the AddressType table to a value of 10. Because the table has existing rows, the next row inserted will use 11 as the value, that is, the current identity value plus 1, the current increment value defined for the column.

USE AdventureWorks2008R2;
GO
DBCC CHECKIDENT ("Person.AddressType", RESEED, 10);
GO

Read more at msdn.microsoft.com

 

This entry was posted in Development, Uncategorized and tagged , , , , . Bookmark the permalink.