title: Declare variables to DbMigration.CreateStoredProcedure
body: <p>I'm trying to use <code>DbMigration.CreateStoredProcedure</code> to create a function that takes an integer <code>InvoiceId</code> and returns a decimal. However, when I apply the migration, I get this error:</p>
  
  <blockquote>
    <p>Must declare the scalar variable "@InvoiceId".</p>
  </blockquote>
  
  <p>This is the EF migration code:</p>
  
  <pre><code>CreateStoredProcedure("SumInvoiceTransactions", b =&gt; b.Decimal(9, 2),
      "RETURN (SELECT SUM(Amount) FROM Transactions WHERE InvoiceId=@InvoiceId)");
  </code></pre>
  
  <p>This is the equivalent SQL code:</p>
  
  <pre><code>CREATE FUNCTION SumInvoiceTransactions(@InvoiceId int) RETURNS decimal
  AS BEGIN
    RETURN (SELECT sum(Amount) FROM Transactions WHERE InvoiceId=@InvoiceId)
  END
  </code></pre>
  
  <p>How do I declare the parameter?</p>