locked
Table-record-seed problem RRS feed

  • Question

  • I have created a new table in SQL Server 2005 for my database. I created a few  records for practice. Then I decided to make one of my fields a primary key with a seed starting at 82000. I add 1 every time a new record is created. However, with the practice records, I created numbers in this primary key field that were much larger, just to place data in and see the results on a front end app. (Access) For instance, the highest number was 9999989. Now SQL wants to add 1 to that number. So, my next record (primary key field) adds 1 to 9999989 for a result of 9999990. So, I went back and deleted the old useless practice records but it is still adding 1 to the much higher number. How do I get it to reset and start fresh at 82000?

    Thanks for your help

    Divad
    DR
    Thursday, June 4, 2009 9:30 PM

Answers

All replies

  • hi Divad,
    you have to use DBCC CHECKIDENT functionnality, reseeding the system generated values.. http://msdn.microsoft.com/en-us/library/ms176057.aspx
    regards
    http://www.asql.biz - DbaMgr2k - DbaMgr and further SQL Tools
    • Marked as answer by Darkenmoor Friday, June 5, 2009 4:20 PM
    Thursday, June 4, 2009 11:15 PM
  • Thank you Andrea. This was the answer I needed.

    What a great resource you guys are for folks like me.

    Kindest regards,

    Divad
    DR
    Friday, June 5, 2009 4:23 PM