Friday, September 11, 2009

Reset auto number from a SQL table after delete

When you have an auto number on a table and you deletes the rows in the table you have to reset the autonumber value.


DELETE FROM tblName
DBCC CHECKIDENT (tblName,RESEED, 0)

The first lines throws all the rows in tblName away and with the second row the auto number is reset


read here more information

No comments:

Post a Comment