Geekpedia Programming Tutorials






How to reset the identity column of a SQL table

On Wednesday, December 14th 2005 at 10:07 AM
By Andrew Pociu (View Profile)
*****   (Rated 5 with 1 votes)
Advertisement
More SQL Resources
To reset the value of the identity column in a Microsoft SQL table run the below query:

DBCC CHECKIDENT (TableName, RESEED, 0)

You will need to change TableName to the name of the table you wish to reset. This query will reset the identity column to 0, meaning the next row will have the identity 1. You can change 0 to whatever identity you wish to start from.
Digg Digg It!     Del.icio.us Del.icio.us     Reddit Reddit     StumbleUpon StumbleIt     Newsvine Newsvine     Furl Furl     BlinkList BlinkList

Rate Rate this Knowledge Base article
Comment Current Comments
by vipul on Wednesday, September 13th 2006 at 02:48 AM

thanks for this query. i solve my problem help of this query.
i want to information how to use trigger.

by Rajalakshmi.C on Wednesday, August 1st 2007 at 03:36 AM

Server: Msg 2560, Level 16, State 1, Line 1
Parameter 2 is incorrect for this DBCC statement.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.

I am using this query. i got this msg... if you know the
the details kindly get back to me...

by mukund on Monday, September 17th 2007 at 05:30 PM

is it possible to change the identity from one column to another in a temp table.. if so please give me the query in sql

by Bill on Thursday, October 23rd 2008 at 08:46 AM

Thanks for help. It help me a lot.


Comment Comment on this Knowledge Base article
Name: Email:
Message:
Knowledge Base Related Knowledge Base Articles
There are no related KB articles.

Comment Related Source Code
There is no related code.

Comment Related Tutorials
There are no related tutorials.

Jobs SQL Job Search
My skills include:

Enter a City:

Select a State:


Advanced Search >>
Advertisement

Free Magazine Subscriptions

Today's Pictures

Today's Video

Other Resources

Latest Download

Latest Icons