DelphiFAQ Home Search:

How to reset or reseed the IDENTITY column


commentsThis article has not been rated yet. After reading, feel free to leave comments and rate it.

How can I reset or reseed the IDENTITY column?

See DBCC CHECKIDENT in SQL Server Books Online.

A quick and dirty way to reset the IDENTITY column would be to run TRUNCATE TABLE command on that table. TRUNCATE TABLE will delete all the rows from the table and reset the IDENTITY column. However, you will not be able to run TRUNCATE TABLE on a table referenced by foreign keys.

Content-type: text/html


2009-01-19, 22:55:19
anonymous from India  
dbcc checkident('Table_name',RESEED,0)
here 0 means where u want generate id. if u put 0 means id will generate from 1
2014-03-18, 13:31:15
How can any review of the purchasing managers' data using the instruction select add a field showing the first record numbers 1,2,3 ... always tidy
Thank you
2015-02-01, 04:14:58
anonymous from United States  
Thta's the best answer of all time! JMHO
2015-02-02, 06:08:20
anonymous from Beijing, China  
I believe we need to add some intropamt things here. I am putting them if information is ok then please add them in your article.mysqldump will backup by default all the triggers but NOT the stored procedures/functions. There are 2 mysqldump parameters that control this behavior: routines - FALSE by default triggers - TRUE by defaultSo if you want to take backup of whole database +procedures/ functions you can do it by below command mysqldump -u username -p database_name --routines > output_db_file_name.sql [url=]m..dudk[/url] [link= http://zixkzhlntpo...tpo[/link]



NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: