If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > reset autonumber fields

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-10-05, 12:54
dizjen dizjen is offline
Registered User
 
Join Date: Mar 2005
Posts: 3
reset autonumber fields

How can I reset autonumber fields after i have emtied a table, so I can start with a clean database after testing it.
Reply With Quote
  #2 (permalink)  
Old 03-10-05, 18:04
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
instead of deleting rows, use truncate tablename, this resets the auto_increment
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 01-20-06, 11:11
millercepbs millercepbs is offline
Registered User
 
Join Date: Jan 2006
Posts: 1
Autonumber Reset

ALTER TABLE `database_name`.`table_name` AUTO_INCREMENT = ##;

This will allow you to reset the starting point on your autoincrement. I had it set to auto, but a php page I made had somehow set it to 8000. So sometimes it is beneficial to be able to reset things back down to where they are logical.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On