SQL Server Identity Differences
@@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
http://www.flexicoder.com/blog/index.php/2009/04/scope_identity-identity/
Written by Paul Ledger
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Stored procedures
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#