Return to Snippet

Revision: 22075
at December 31, 2009 10:52 by CDIDevs


Initial Code
DECLARE @TableName varchar(255)
DECLARE @MaxID INT

set @TableName = 'Categories'

SELECT @MaxID = MAX(category_id)
FROM categories
DBCC CHECKIDENT(@TableName, RESEED, @MaxID)
GO

Initial URL
http://blog.sqlauthority.com/2009/04/01/sql-server-reseed-identity-of-table-table-missing-identity-values-gap-in-identity-column/

Initial Description
Re-seed identity table if rows were deleted/there are gaps in numerical order

Initial Title
Re-seed Identity Table

Initial Tags
sql

Initial Language
SQL