@@IDENTITY will return the last identity value after any triggers have been
called (i.e. you could end up getting the identity of an updated record in
another table as a result of a trigger).

SCOPE_IDENTITY() returns the identity of the current scope, ie. The identity
of the table you insterted/updated data into, excluding any trigger that may
have been set off.

The only disadvantage is that SCOPE_IDENTITY() only exists in SQL 2000 as
far as I am aware.  You only have @@IDENTITY in SQL 7.0 and earlier (there
may be an alternative, but I am not sure what it is).

Unfortunately, I am not sure of the Oracle equivalent.

Cheers
Brian Johnson

-----Original Message-----
From: Ben Kloosterman [mailto:[EMAIL PROTECTED]]
Sent: 09 July 2002 05:07
To: [EMAIL PROTECTED]
Subject: Re: [ADVANCED-DOTNET] ADO.NET: Parent-child relationship and
auto-increment columns


Why SCOPE_INDENTITY() rather than @@IDENTITY ?

Also is there an Oracle equivalent ?

Ben

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to