Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
I think you should post it on StackOverflow – kristof Apr 30 '09 at 10:52
up vote 3 down vote accepted

I think this question belongs to SO.

For example you may find renumber primary key helpful

share|improve this answer

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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