title: Use WHERE clause when execute stored procedure
body: <p>I've stored procedure to view data transaction by joining other tabel</p>
  
  <pre><code>create procedure prRecapitulation
  as
  begin
      SELECT      a.TransactionID,
                  a.Buyer_Code,
                  a.Date_Transaction,
                  b.NuggetID,
                  SUM(b.Qty) as Qty,
                  SUM(b.Sub_Total) as Sub_Total,
                  SUM(a.Total_Price) as Total_Price
      FROM        Transactions a JOIN DetailTransaction b On a.TransactionID = b.TransactionID
      WHERE       DAY(a.Date_Transaction) = 21 AND MONTH(a.Date_Transaction) = 01 AND YEAR(a.Date_Transaction) = 2017
      GROUP BY    a.TransactionID, a.Buyer_Code, a.Date_Transaction, b.NuggetID
      ORDER BY    a.Date_Transaction DESC
  end
  </code></pre>
  
  <p>But i've thinking to remove WHERE clause from stored procedure because sometime (maybe) the conditions will change based on number 21, 01 and 2017.</p>
  
  <p>here's my expectation query</p>
  
  <pre><code>exec prRecapitulation
  where DAY(a.Date_Transaction) = 21
  </code></pre>
  
  <p>So the procedure can display the transaction based on date 21 or use <code>MONTH()</code> or <code>YEAR()</code> function as well.</p>