Differences between SCOPE_IDENTITY and @@IDENTITY

@@IDENTITY will return the last id that was created using your connection, therefore if your insert kicks off a trigger you could get the wrong id.

But SCOPE_INDENTITY() will return the last identity created


Leave a Reply