title: Stored procedure select max value and insert
body: <p>I am trying to select max: value from a table and insert value into same table.</p>
  
  <p>The code is:</p>
  
  <pre><code>CREATE PROCEDURE [dbo].[InsertLogin]
      @LOG_ID INT OUTPUT,
      @LOG_NAME VARCHAR(100),
      @LOG_EMAIL VARCHAR(100)
  AS
      INSERT INTO login(LOG_NAME, LOG_EMAIL) 
      VALUES(@LOG_NAME, @LOG_EMAIL)
  
      SET @LOG_ID = @@IDENTITY
  </code></pre>
  
  <p>The other values are inserting except LOG_ID its getting null.</p>