title: CASE expression yields error when mixing types
body: <p>Consider the following:</p>
  
  <pre><code>SELECT [DOB] = CASE WHEN [DOB] = '-' then 'invalid date' ELSE cast([DOB] as datetime) 
  END
  FROM myTable where myID = 73351
  </code></pre>
  
  <p>When <code>DOB = '-'</code>, I get the error message: </p>
  
  <blockquote>
    <p>Conversion failed when converting datetime from character string.</p>
  </blockquote>
  
  <p>Which seems to indicate SQL Server tries to cast DOB as <code>datetime</code> despite the fact it should only print <code>'invalid date'</code>.</p>
  
  <p>Yet consider this which correctly returns <code>'invalid date'</code> when <code>DOB = '-'</code>.</p>
  
  <pre><code>SELECT [DOB] = CASE WHEN [DOB] = '-' then 'invalid date' ELSE 'valid date'
  END
  FROM myTable where myID = 73351
  </code></pre>
  
  <p>How can I get the first statement to return <code>'invalid date'</code> when <code>DOB = '-'</code>?</p>