title: SQL: IF clause within WHERE clause
body: <p>Is it possible to use an <strong>IF</strong> clause within a <strong>WHERE</strong> clause in MS SQL?</p>
  
  <p>Example:</p>
  
  <pre><code>WHERE
      IF IsNumeric(@OrderNumber) = 1
          OrderNumber = @OrderNumber
      ELSE
          OrderNumber LIKE '%' + @OrderNumber + '%'
  </code></pre>