I have an existing table where the first few rows have been deleted. Is it possible to reset the primary key so the existing data Id column changes back to 1,2,3..?

  • 2
    I think you should post it on StackOverflow – kristof Apr 30 '09 at 10:52

I think this question belongs to SO.

For example you may find renumber primary key helpful


This should work: DBCC CHECKIDENT(tableName, RESEED, 0). The tip is from here


Please see Pinal Dave's blog post: http://blog.sqlauthority.com/2007/03/15/sql-server-dbcc-reseed-table-identity-value-reset-table-identity/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.