Results 1 to 3 of 3

Thread: [RESOLVED] reset auto_number field in SQL Server

  1. #1

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945

    Resolved [RESOLVED] reset auto_number field in SQL Server

    I have my reasons, so don't ask me why. I have an auto_number field in a database and that number is currently up to ~80,000 after some testing I've done. I'd like to reset that number to 0.

    Anyone know how? SQL Server 2K SP3.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  2. #2
    Fanatic Member
    Join Date
    Sep 2000
    Posts
    770

    Re: reset auto_number field in SQL Server

    In mysql you would use the expression
    Code:
    AUTO_INCREMENT = 0
    in an update or alter statement
    In sql server, you do this:
    Code:
     DBCC CHECKIDENT('table_name', RESEED, 0)
    http://msdn.microsoft.com/library/de..._dbcc_5lv8.asp

  3. #3

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945

    Re: reset auto_number field in SQL Server

    Perfect. Thanks!
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

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