How can I clear a table and reset the identity back to 0?

Neil Pike

July 27, 1999

1 Min Read
ITPro Today logo in a gray background | ITPro Today

A. If there are no foreign keys on the table then a simple TRUNCATE TABLE will do the trick.

If there are foreign keys then first delete all rows - DELETE

Then reset the identity :-

Under 7.0 - DBCC CHECKIDENT(,RESEED,0)

Under 6.5 - DBCC CHECKIDENT()

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like