title: SQL Server: pass next value of sequence to procedure
body: <p>I'm new to Microsoft SQL Server. I have to call an existing procedure and I want to pass the next value of an sequence.</p>
  
  <p>Here a rough overview of my objects and the way I want to pass the values:</p>
  
  <p>I've created an sequence, like </p>
  
  <pre><code>CREATE SEQUENCE mySeq START WITH 10000 CACHE 50;
  </code></pre>
  
  <p>Also, I created a procedure like </p>
  
  <pre><code>CREATE PROCEDURE P_MY_PROCEDURE
       (@V_TECHNICAL_ID BIGINT, @V_VALUE VARCHAR(254))
  AS
  BEGIN
      INSERT INTO mytable (key, value) 
      VALUES (@v_technical_id, @v_value);
  END@
  </code></pre>
  
  <p>Now, I would like to call the procedure mentioned above the following way:</p>
  
  <pre><code>EXEC P_MY_PROCEDURE NEXT VALUE FOR mySeq, 'Some Value';
  </code></pre>
  
  <p>While using the previous line, I get the following error:</p>
  
  <blockquote>
    <p>[Error Code: 102, SQL State: S0001]  Incorrect syntax near 'NEXT</p>
  </blockquote>
  
  <p>What is wrong? With other RDBMS (like Oracle, DB2), the way execution the procedure works without any problems</p>