1

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
  • 2
    I think you should post it on StackOverflow
    – kristof
    Apr 30, 2009 at 10:52
  • I’m voting to close this question because it actualyl belongs either to stackoverflow or dba.stackexchange
    – TomTom
    Aug 6, 2022 at 12:07

3 Answers 3

3

I think this question belongs to SO.

For example you may find renumber primary key helpful

1

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

0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .