title: Using CASE with DATE Type in WHERE clause
body: <p>I want to use <code>CASE</code> with DATE Type in <code>WHERE</code> clause, so when <code>@birthFrom</code> or <code>@birthTo</code> is <code>NULL</code> return all record.</p>
  
  <pre><code>DECLARE @birthFrom DATE= NULL --'19941012'
  DECLARE @birthTo DATE= NULL --'20101012'
  
  SELECT  *
  FROM    dbo.bbmf
  WHERE   birth BETWEEN ( CASE @birthFrom
                        WHEN NULL THEN birth
                        ELSE @birthFrom
                      END )
            AND     ( CASE @birthTo
                        WHEN NULL THEN birth
                        ELSE @birthTo
                      END )
  </code></pre>
  
  <p><strong>My problem is:</strong> when I execute the above code there is no record selected <br><br></p>
  
  <p>Any suggestion?</p>