Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2006
    Posts
    56

    Unanswered: Resetting an IDENTITY field

    I have an IDENTITY field (used as a primary key) that increments sequentially when a new row is added. The data will be deleted\refreshed periodically and I want to reset the Identity field back to 1. How can I do this?

  2. #2
    Join Date
    Feb 2002
    Location
    Willy is on vacation
    Posts
    1,208
    set IDENTITY_INSERT ON

    insert the value of 1 into the IDENTITY column

    set IDENTITY_INSERT OFF

    From then on, it will reset from 2 onwards

  3. #3
    Join Date
    Aug 2006
    Posts
    56
    Thanks
    ....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •