Results 1 to 3 of 3

Thread: SQL Server - Reinitialize auto-increment values

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2004
    Posts
    369

    SQL Server - Reinitialize auto-increment values

    Hi,

    I have around 10-15 tables that I want to clear.
    Is there a quick way (in a script) to have the auto-increment field restart at 1 ?

    Thank you.

  2. #2
    Addicted Member
    Join Date
    Feb 2008
    Location
    California
    Posts
    151

    Re: SQL Server - Reinitialize auto-increment values

    DBCC CHECKIDENT ("tablename", RESEED, 1);

  3. #3
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: SQL Server - Reinitialize auto-increment values

    Or just truncate the table, that will reset the identities... (but that requires more permissions)

Posting Permissions

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



Click Here to Expand Forum to Full Width