It depends on what you are trying to do ...
@@ IDENTITY
Returns the last IDENTITY value created in the join, regardless of the table that produced the value, and regardless of the scope of the statement that produced this value. @@ IDENTITY will return the last identifier value entered in the table of the current session. @@ IDENTITY is limited to the current session and not limited to the current area. For example, if you have a trigger in a table that forces an individual to be created in another table, you will get the identifier that was created last, even if it was the trigger that created it.
SCOPE_IDENTITY ()
Returns the last IDENTITY value created in the join and by the operator in the same scope, regardless of the table that generated the value. SCOPE_IDENTITY () is similar to @@ IDENTITY, but it also limits the value of the current scope. In other words, it will return the last identifier value that you explicitly created, and not any identity created by a trigger or user-defined function.
IDENT_CURRENT ()
Returns the last IDENTITY value created in the table, regardless of the connection and scope of the statement that generated the value. IDENT_CURRENT is limited to the specified table, but not to a join or scope.
mson Jan 26 '09 at 21:28 2009-01-26 21:28
source share