Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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
2  
I think you should post it on StackOverflow –  kristof Apr 30 '09 at 10:52

3 Answers 3

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

 
discard

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.