Identity inserts - how to reset seed after insert?

  • I have a problem where I have two tables, one is set to have odd numbers, the other even numbers in there identity columns. I need to be able to insert these records into each table without the identity seed resetting to the highest last value inserted. How do I reset the seed to the highest odd/even number respectively without a table rebuild? 

  • Never used this..but check BOL on this..

    DBCC CHECKIDENT ('table_name', RESEED, new_reseed_value)

    HTH


    Mathew J Kulangara
    sqladventures.blogspot.com

  • That did the trick thx

  • Yep that works and for info I have used in anger in a merge replication setup when SQL Server got the next seed value corrupt.  It somehow had its next value even though it had created rows with seed value > than next.  This DBCC allows you to start at a value > than highest value already stored .

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

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