Reset table Identity

  • How do I reset the Identity counter for a table?

    Thanks

    Jim

  • User TRUNCATE TABLE

    Regards,
    Nitin

  • Use TRUNCATE TABLE

    Regards,
    Nitin

  • Thanks!!

  • what do you mean by reseed?

    Truncate is going to remove all your data!

    What about DBCC CHECKIDENT (tableName,reseed, ?)

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • truncate will remove all data AND reset the identity to it's starting value, whatever that was. It doesn't have to be 1.

    DBCC RESEED will reset it to the value you specify, which can be anything.

    depending on what you want to do, choose the appropriate one. Note that identities are not necessarily unique.

Viewing 6 posts - 1 through 5 (of 5 total)

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