Resetting Key Column Numeration from SQL Tables

  • I used a lot of fictitious data in order to test the code of my web site. But I noticed that when I deleted all fictitious data from the tables, the primary key columns keep creating automatically numbers that are above the last one before all data was erased instead of starting again from number 1. How do I reset this automatic numeration in order to restart from 1 again ?

  • look up DBCC CHECKIDENT with the RESEED option.

  • Use the DBCC CHECKIDENT to reseed the identity columns or truncate the tables (if you don't have foreign keys defined).

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply