MySQL Forums
Forum List  »  Stored Procedures

Re: Multipline lines insert in a table with Autoincrement field
Posted by: Rick James
Date: March 02, 2013 09:27PM

> breaking the sequence

Tough! Ok, I should not be that brutal. But the fact is, that there are several cases in which AUTO_INCREMENT reserves the right to give you whatever numbers it likes. All it guarantees is that the numbers will be different.

After you INSERT multiple rows (in a single INSERT statement),
SELECT LAST_INSERT_ID()
will return the first id assigned.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Multipline lines insert in a table with Autoincrement field
1138
March 02, 2013 09:27PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.