title: Passing Multiple Between Statements To Stored Procedure
body: <p>I have a table full of products, previously we passed a <code>MaxPrice</code> and <code>MinPrice</code> to the stored procedure and selected products with the price between two values. </p>
  
  <p>But now I want to pass multiple range values and want to select products that their prices are between multiple ranges.</p>
  
  <p>Let's say I had a stored procedure like this:</p>
  
  <pre><code>@PriceMin decimal(18, 4) = null,
  @PriceMax decimal(18, 4) = null,
  
  ... 
  WHERE 
      product.Price &gt; @PriceMin 
      AND product.Price &lt; @PriceMax
  </code></pre>
  
  <p>but now I want to pass multiple range of values based on user selection and have a select like this:</p>
  
  <pre><code>WHERE 
      (product.Price &gt; @PriceMin1 AND product.Price &lt; @PriceMax1)
      OR (product.Price &gt; @PriceMin2 AND product.Price &lt; @PriceMax2)
      OR (product.Price &gt; @PriceMin3 AND product.Price &lt; @PriceMax3)
  ...
  </code></pre>
  
  <p>How can I do this?</p>