Re: Get Last ID Inserted

From: Date: Fri, 22 Nov 2002 09:07:04 +0000
Subject: Re: Get Last ID Inserted
References: 1 2 3  Groups: php.db 
Request: Send a blank email to php-db+get-23587@lists.php.net to get a copy of this message
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Greetings Adam On 21 November 2002 at 11:12:46 -0500 (which was 16:12 where I live) Adam Voigt emanated these words of wisdom > 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? No unless you drop the connection, but then it should give you a NULL. To quote M$ ==========8<============================================================= Remarks IDENT_CURRENT is similar to the Microsoft® SQL Server™ 2000 identity functions SCOPE_IDENTITY and @@IDENTITY. All three functions return last-generated identity values. However, the scope and session on which 'last' is defined in each of these functions differ. IDENT_CURRENT returns the last identity value generated for a specific table in any session and any scope. @@IDENTITY returns the last identity value generated for any table in the current session, across all scopes. SCOPE_IDENTITY returns the last identity value generated for any table in the current session and the current scope. ==========8<============================================================= - -- Ti2GO, _______________________________________________ David | David Elliott | Software Engineer | _________________________| david@elliott.uk.com | PGP Key ID 0x650F4534 | | I didn't do it! Nobody saw me do it! You can't prove anything! | -----BEGIN PGP SIGNATURE----- Version: 6.5.8ckt http://www.ipgpp.com/ iQA/AwUBPd3zufmK8eZlD0U0EQJ37QCglnr+5j0h7CSOG39qznRq2F8fZNIAn10R xhMTzYhlrvim4iyzB0rny48J =DtzT -----END PGP SIGNATURE-----

« previous php.db (#23587) next »