-----BEGIN PGP SIGNED MESSAGE-----
On 21 November 2002 at 11:12:46 -0500 (which was 16:12 where I live) Adam
Voigt rearranged electrons to get
> 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. It picks up the last identity on that connection. So it does not mater
how many other connections and what they are doing.
It can only be wrong if you close off the connection and open another one.
The other way is to put it all into one SQL statement (as long as you don't
use mssql_????? functions in PHP)
e.g. (one I used earlier)
set nocount on
set name = 'Canada Delivery'
where itemid = '428'
insert into item
(ItemTypeId, Name, LastUpdated)
set @NewId = @@identity
insert into DelArea
(itemid,StdEUR, StdGBP, StdUSD, HotEUR, HotGBP, HotUSD)
set DelId = @NewId
where itemid = 288
David | David Elliott | Software Engineer |
_________________________| [EMAIL PROTECTED] | PGP Key ID 0x650F4534 |
| Do you think someone was BORGED when they made these up? |
-----BEGIN PGP SIGNATURE-----
Version: 6.5.8ckt http://www.ipgpp.com/
-----END PGP SIGNATURE-----
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php