Last Updated: February 25, 2016
·
939
· flexicoder

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/