NovelProjects

Wednesday, March 5, 2008

Reinitialize MS SQL DB Identity

Sometimes you'll find the need to reinitialize your identity column in a database back to a certain value. Maybe the values are higher than you would like and you want to start back at a lower range. Or perhaps you've deleted all the data and would like the table to start indexing at a lower value. The command to do this in Microsoft's SQL is "DBCC CHECKIDENT (tablename, reseed, reinitialize to this value)".



DBCC CHECKIDENT (TestTable, reseed, 15) would start the indexing at the value 15 for TestTable.