Tuesday, July 28, 2009

Reseed the identity column of a table in SQL Server

When you want the identity field of a table to be reset (start with id 1 again), execute the following SQL query:

DBCC CHECKIDENT (tableName, reseed, 0)

Where "tableName" is replaced by the name of your table and the 0 is the new seed.

/Ruud

No comments:

Post a Comment