On Jun 23, 2004, at 8:15 AM, Michael Stassen wrote:
So, if I understand you correctly, somewhere in the middle of a 20,000 row insert, a row gets inserted with auto_increment id = 87,123,456, say, then the next row tries to insert with the value 87,123,457 but fails. You fix this by skipping the next value with
ALTER TABLE yourtable AUTO_INCREMENT=87123458
After that, the auto_increment id column resumes working as expected, until the next time. Is that right?
Yes. I've looked at the table status, and it appears to be OK, and the AUTO_INCREMENT values look good (except as below).
Have you tried resetting the auto_increment id by manually inserting a larger number?
INSERT INTO yourtable (id) values (87123458);
No... I'll give that a try next time round.
multiple row INSERT statement, LAST_INSERT_ID() returns the auto_increment id of the first row inserted. (See <http://dev.mysql.com/doc/mysql/en/Information_functions.html>) So, if you've just done a multiple row insert, LAST_INSERT_ID()+1 should already exist as an ID in the table.
I'll have to take a look at that--hadn't thought to look at the effect of the multiple row insert. Thanks.
Kevin
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]