At 21:00 -0500 12/29/02, Carlin Anderson wrote:
I have a number of databases installed under mysql 3.23 and 4.0, and will need to occasionally re-initialize certain tables. Can I re-set auto-increment fields within those tables?
You can drop and re-create the tables.  This will work for any table type.

For ISAM tables, if you delete all the records, that will automatically
reset the counter.

For MyISAM tables, you can delete all the records, then use:
ALTER TABLE tbl_name AUTO_INCREMENT = 1
which will reset the counter.

If what you mean is that you want to leave the existing records intact, but
resequence the AUTO_INCREMENT column so that the sequence doesn't
have holes in it, then I'd ask:  why bother?

Thanks
Carlin Anderson


---------------------------------------------------------------------
Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to