| List: | General Discussion | « Previous MessageNext Message » | |
| From: | Paul DuBois | Date: | January 30 2002 12:46am |
| Subject: | Re: next insert id | ||
| View as plain text | |||
At 15:35 -0800 1/29/02, James Montebello wrote: >Of course, if you do LAST_INSERT_ID, then try to use the value while someone >else is doing an insert, you're in the same boat. Neither method is reliable >without a lock. That's incorrect. LAST_INSERT_ID() is client-specific, other clients can't mess you up. > >james montebello > >On Tue, 29 Jan 2002, Paul DuBois wrote: > >> At 15:16 -0800 1/29/02, James Montebello wrote: >> >SELECT MAX(id) FROM table; >> > >> >will get you the highest value for 'id', that +1 will be the 'next' value, >> >until someone inserts a new row into that table. >> >> Which may already have happened between the time you created your record >> and the time you issue the SELECT shown above. In which case, you'll get >> the wrong result. Use LAST_INSERT_ID() instead. >> >> > >> >james montebello >> > >> >On Tue, 29 Jan 2002, Joel Wickard wrote: >> > >> >> database,sql,query,table >> >> >> >> >> >> I need to find out what the next value will be in an >>auto_increment field >> > > will be. could someone help me out with the select statement? >>
| Thread | ||
|---|---|---|
| • next insert id | Joel Wickard | 30 Jan |
| • Re: next insert id | James Montebello | 30 Jan |
| • Re: next insert id | Nathan | 30 Jan |
| • Re: next insert id | Christopher Thompson | 30 Jan |
| • Re: next insert id | Christopher Thompson | 30 Jan |
| • Re: next insert id | James Montebello | 30 Jan |
| • Re: next insert id | Paul DuBois | 30 Jan |
| • Re: next insert id | Paul DuBois | 30 Jan |
| • Re: next insert id | James Montebello | 30 Jan |
| • RE: next insert id | Roger Baklund | 30 Jan |
| • Re: next insert id | Paul DuBois | 30 Jan |
| • RE: next insert id | Johnny Withers | 30 Jan |
| • Re: next insert id | laszlo | 30 Jan |
| • Re: next insert id | Paul DuBois | 30 Jan |
| • Re: next insert id | Paul DuBois | 30 Jan |
| • Re: next insert id | Paul DuBois | 30 Jan |
| • Re: next insert id | James Montebello | 30 Jan |
| • Re: next insert id | Paul DuBois | 30 Jan |
| • Re: next insert id | DL Neil | 30 Jan |
| • Re: next insert id (slightly OT) | William R. Mussatto | 30 Jan |
| • Re: next insert id (slightly OT) | DL Neil | 30 Jan |
| • Re: next insert id (slightly OT) | William R. Mussatto | 30 Jan |
