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!

How do I reset auto_increment to start at zero 2

Status
Not open for further replies.

jimoblak

Instructor
Oct 23, 2001
3,620
US
I have just cleared the contents of a table and the table is retaining the last auto_increment value. How can I get this reset to zero?

The last time I did this I dropped the table and then recreated it. Is there an easier way to get back to zero?
 
I threw in a conditional...

DELETE FROM <tablename> WHERE fieldname>1

Being ambiguous as you suggested did the trick. Thanks
 
ALTER TABLE <tablename> AUTO_INCREMENT=1
 
i tried sleipnir's way, but it kept the last value. taywq's solution did the trick for me!

that is to say, try just deleting, but if that doesn't work, you can beat it into submission. :)

inger
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top