an issue where you have a trigger that inserts into a different table that
has an IDENTITY field in it. In that case, @@IDENTITY will return the
inserted ID from the trigger rather than your your original insert. Also,
as Rob stated, SCOPE_IDENTITY() is only available in SQL Server 2000...
>
> I use it because our DBA has a habit of adding triggers to our tables
without our knowledge... been burned once by it before.
>
> As for actual usage, it's pretty much the same as @@IDENTITY:
Yeah, I thought Rob did a pretty good job of explaining it. I had never
messed with it, but the bit about triggers kinda worried me because of that
very issue that I was afraid of. I'm going to play with it later and will
probably be replacing my @@IDENTITY with the SCOPE_IDENTITY() since we're
only using SQL Server 2000 right now and in the foreseeable future.
Thanks.
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

