Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Primary Key Problem

Status
Not open for further replies.

webwingit

Technical User
Sep 17, 2002
13
CL
In mysql database i have been deleting a lot of records. I have the primary key field called ID and set to auto_encrement. I would like to know is there is a way to make mysql use the freed up ID numbers coming from the deleted records.
 
The only way to cause MySQL to reuse numbers in an autoincrement is by performing "DELETE * from tablename". When it recieves that command, MySQL drops and recreates the table.

Why would you want to reuse the numbers? ______________________________________________________________________
TANSTAAFL!
 
I have been using the database to test my site for the last month and just had a lot of records of no value. I am rady to put the site up now and just wanted to start from 0 no other reason. thanks
 
I'd dump out the data you want to keep, perform "DELETE * from tablename", then repopulate. ______________________________________________________________________
TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top