title: Return identity of last inserted row from stored procedure
body: <p>I am trying to return identity of last inserted row from a stored procedure.</p>
  
  <p>A simplified version of my code looks like this:</p>
  
  <pre><code>CREATE PROCEDURE [sp_name]
      @AuthorisationCode uniqueidentifier
  AS
      INSERT INTO [tablename]
             ([AuthorisationCode]
             )
       VALUES
             (@AuthorisationCode
             )
  
   RETURN @@IDENTITY
  
  GO
  </code></pre>
  
  <p>I am calling this stored procedure via Execute Scalar in Enterprise library 4.1. </p>
  
  <p>It returns null. Anybody see what I am doing wrong.</p>