title: SQL check for NULLs in WHERE clause (ternary operator?)
body: <p>What would the SQL equivalent to this C# statement be?</p>
  
  <p><code>bool isInPast = (x != null ? x &lt; DateTime.Now() : true)</code></p>
  
  <p>I need to construct a <code>WHERE</code> clause that checks that <code>x &lt; NOW()</code> only if <code>x IS NOT NULL</code>. <code>x</code> is a <code>datetime</code> that needs to be null sometimes, and not null other times, and I only want the <code>WHERE</code> clause to consider non-null values, and consider null values to be true.</p>
  
  <p>Right now the clause is:</p>
  
  <p><code>dbo.assignments.[end] &lt; { fn NOW() }</code></p>
  
  <p>Which works for the non-NULL cases, but NULL values always seem to make the expression evaluate to false. I tried:</p>
  
  <p><code>dbo.assignments.[end] IS NOT NULL AND dbo.assignments.[end] &lt; { fn NOW() }</code></p>
  
  <p>And that seems to have no effect.</p>