From the MySQL docs:

The most recently generated ID is maintained in the server on a per-connection basis. It will not be changed by another client. It will not even be changed if you update another AUTO_INCREMENT column with a non-magic value (that is, a value that is not NULL and not 0).

So as long as you're using non-persistent connections, even on a site with heavy traffic it should work fine.


At 11:14 AM 11/21/2002 -0500, you wrote:
I do see that picking up the incorrect ID, which is why we created a stored
procedure which returned the affected row.

-----Original Message-----
From: Adam Voigt [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 21, 2002 11:13 AM
To: David Elliott
Cc: Adam Voigt on PHP-DB
Subject: Re: [PHP-DB] Re: Get Last ID Inserted

But if there are heavy operations on the site, will this not also pick
up a different last inserted id, if in the split milisecond between the
insert and the next mssql_query which has the @@identity say, another
user does an insert?

On Thu, 2002-11-21 at 11:03, David Elliott wrote:
> Hash: SHA1
> Hello Adam
> On 21 November 2002 at 10:47:15 -0500 (which was 15:47 where I live) Adam
> Voigt wrote
> > Using Microsoft SQL does anyone know how to get the id of the row that
> > you just inserted without clumsily trying to select the id back based on
> > the same criteria of your insert (which might be overlapping)?
> select @@identity
> - --
>  Cheers,                   _______________________________________________
>   David                   |    David  Elliott    |   Software Engineer
>  _________________________| [EMAIL PROTECTED] | PGP Key ID 0x650F4534
> | No dinner with Mel Gibson?! - Dot Warner
> Version: 6.5.8ckt
> iQA/AwUBPd0DwfmK8eZlD0U0EQI3fACgsv52o5AvhuroJIVYblYXTnkiDZYAn2Ao
> y1AeA+bR4KPOwZhZTAa2x7kr
> =f/lr
> --
> PHP Database Mailing List (
> To unsubscribe, visit:
The Cryptocomm Group
My GPG Key:

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to