title: SQL placeholders in WHERE clause
body: <p>I searched SO and Google but was unable to make sense of the explanations nor was I able to tell if they were related.</p>
  
  <p>This is my WHERE clause for this report:</p>
  
  <pre><code>WHERE 
      (IC_ProductLots.ProductionDate &gt;= { ts '2015-06-24 00:00:00' }   AND (IC_ProductLots.ProductionDate &lt;= { ts '2015-06-24 00:00:00' } OR IC_ProductLots.ProductionDate Is Null)) 
  AND ((1=1)  AND AR_Customers.CustomerKey IN (124) ) 
  </code></pre>
  
  <p>When the user goes to run the report, the WHERE clause auto populates the information they enter for Production Date, and the Customer Key.</p>
  
  <p>For this report I had to create several variables that are called in the set section. Here is an example:</p>
  
  <pre><code>SET @Shrink  = @InputWeight - (
   SELECT Sum([ICPL].[OriginalQuantity_Stk])
   FROM IC_Products [PC] 
   INNER JOIN DC_Transactions [DCT] 
   ON [PC].ProductKey = [DCT].ProductKey
   INNER JOIN AR_Customers 
   ON [DCT].CustomerKey = AR_Customers.CustomerKey
   INNER JOIN IC_ProductLots [ICPL] 
   ON [DCT].LotKey = [ICPL].LotKey
   LEFT OUTER JOIN IC_ProductCosts [ICP] 
   ON ICP.ProductKey=PC.ProductKey and ICP.ProductCostCode=5
   WHERE (ICPL.ProductionDate &gt;= { ts '2015-06-24 00:00:00' } AND (ICPL.ProductionDate &lt;= { ts '2015-06-24 00:00:00' } OR ICPL.ProductionDate Is Null)) 
  AND ((1=1) AND AR_Customers.CustomerKey IN (124)) 
  );
  </code></pre>
  
  <p>For this WHERE clause in the SET area I need the WHERE clause to populate with the production date and customer key that the user inputs when running the report. Is there a way to do this?
  Let me know if I need to provide more explanation. </p>
  
  <p>I am only using SQL. Microsoft SQL Server 2005. </p>