title: Deleting rows using stored procedure with parameter
body: <p>I am using SQL Server 2008 R2 and I want to create a stored procedure that deletes from two tables using a paramater (id).</p>
  
  <p>This is the stored procedure: </p>
  
  <pre><code>CREATE PROCEDURE [dbo].[sp_deleteDecision]
  @ID int
  AS
  
  DELETE FROM [dbo].[tblDecisionInvolvement] as di
  WHERE di.DecisionId = @ID
  DELETE FROM [dbo].[tblDecision] as d
  WHERE d.Id =@ID
  
  GO
  </code></pre>
  
  <p>This is the error I get when I try to create it:</p>
  
  <blockquote>
    <p>Msg 156, Level 15, State 1, Procedure sp_deleteDecision, Line 6<br>
    Incorrect syntax near the keyword 'as'.<br>
    Msg 156, Level 15, State 1, Procedure sp_deleteDecision, Line 8<br>
    Incorrect syntax near the keyword 'as'.</p>
  </blockquote>
  
  <p>Note that changing the <code>DELETE FROM</code> to</p>
  
  <pre><code>SELECT * FROM 
  </code></pre>
  
  <p>it works.</p>
  
  <p>Is it even possible to delete something using parameters?</p>
  
  <p>Ty.</p>