After I delete all the rows in a table, how do I reset the auto incrementing index without recreating the table or the index?
Try an ALTER TABLE tablename AUTO_INCREMENT=1
Be carefull if you're running multiple database servers as on some versions this does not replicate properly.
Thank you laserlight, that worked.
bubblenut: thanks for the tip.
Is there a way to find out what the current value of the AUTO INCREMENT position is for a field?
Anyone?
SELECT LAST_INSERT_ID()
might work, as might mysql_insert_id()
No, I mean after I call these two queries:
DELETE FROM tablename ALTER TABLE tablename AUTO_INCREMENT=1
How do I ensure that the AUTO_INCREMENT value is 1 before I start inserting data?