SA0012 : Use SCOPE_IDENTITY() instead @@IDENTITY
The topic describes the SA0012 analysis rule.
Use SCOPE_IDENTITY() instead @@IDENTITY
The rule checks for use of @@IDENTITY server variable. It is recommended to use SCOPE_IDENTITY() instead. @@IDENTITY is not limited to a specific scope and is not a reliable indicator of the most recent user-created identity if the column is part of a replication article.
The rule has a Batch scope and is applied only on the SQL script.
Rule has no parameters.
The rule does not need Analysis Context or SQL Connection.
Design Rules, Bugs
There is no additional info for this rule.
1-- SA0012 analysis rule is voilated here 2SELECT @@IDENTITY 3 4-- OK 5SELECT SCOPE_IDENTITY()
|1||SA0012 : Use SCOPE_IDENTITY() instead @@IDENTITY.||2||7|