title: @@ERROR in SQL Server 2005
body: <p>I have learned to use the <code>SCOPE_IDENTITY()</code> instead of just <code>@@IDENTITY</code>to get the last identity value inserted in a given scope, which can be quite useful in high-concurrency scenarios. Is there any equivalent to that function for the @@ERROR variable? I mean, is there any way to make sure that whenever I write</p>
  
  <p><code>IF (@@ERROR &lt;&gt; 0) RETURN</code></p>
  
  <p>I am in fact forcing the function to return because of the very last command in this scope caused an error?</p>