MySQL Forums
Forum List  »  Newbie

Re: Last/highest ID?
Posted by: David Garstang
Date: November 27, 2010 04:37AM

OK, then I don't understand why you care what the ID will be before you do your insert. Can't you just do the insert, then get the ID after the fact? I was assuming that you needed to know what ID you'd be getting before you completed the insert, and just guessed at your reason.

If you do need to know ahead of time, that sequence will work, whatever the reason. You can "reserve" the ID in advance by doing an initial insert, grabbing the assigned ID via LAST_INSERT_ID, then finalizing the record via an update.

Options: ReplyQuote


Subject
Written By
Posted
November 26, 2010 07:41AM
November 26, 2010 07:48AM
November 26, 2010 07:56AM
November 26, 2010 08:24AM
November 26, 2010 08:29AM
November 26, 2010 08:32AM
November 26, 2010 09:08AM
November 26, 2010 09:35AM
November 26, 2010 11:38AM
November 26, 2010 04:07PM
November 26, 2010 08:40PM
November 27, 2010 04:22AM
November 27, 2010 04:27AM
Re: Last/highest ID?
November 27, 2010 04:37AM
November 27, 2010 04:43AM
November 27, 2010 05:25AM
November 27, 2010 05:44AM
November 27, 2010 05:49AM
November 27, 2010 12:38PM
November 26, 2010 07:48AM


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.