Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
|
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 15th, 2004, 02:48 PM
Registered User
 
Join Date: Sep 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Renumber Identity Fields

    I have done this before, but I cannot remember how to reset an Identity field in a table. For example, I want the next record inserted to have an ID of 130,000. Please point me in the right direction.
Thank you.
Keith

 
Old September 15th, 2004, 09:07 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Here you go...
Code:
DBCC CHECKIDENT (TableName, RESEED, 130000)
Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old September 30th, 2004, 05:20 AM
Friend of Wrox
 
Join Date: Sep 2004
Posts: 109
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Anantsharma Send a message via Yahoo to Anantsharma
Default

Happy is correct but be carefull to RESEED with one less value
After insertion it will come to correct.

If u want next row with ID=200, u should use RESEED with 199.

Hey u should also see SET Identity_Insert.

B. Anant





Similar Threads
Thread Thread Starter Forum Replies Last Post
@@IDENTITY use... neo_jakey Classic ASP Professional 1 May 3rd, 2008 06:47 AM
Identity column jbenson001 SQL Server 2000 5 April 12th, 2005 02:01 PM
what does identity do amruthhr SQL Server 2000 2 January 6th, 2005 09:45 AM
Using Forum fields select fields on the fly hellosureshkumar Crystal Reports 0 December 17th, 2004 08:20 AM
Identity soccers_guy10 SQL Server 2000 3 September 2nd, 2003 07:05 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.