title: Casting 0 as DATE and DATETIME
body: <p>I just happened to stumble upon this and couldn't find any technical explanation:</p>
  
  <p>In SQL Server 2014:</p>
  
  <pre><code>SELECT CAST('' AS DATETIME);
  1900-01-01 00:00:00.000
  
  SELECT CAST(0 AS DATETIME);
  1900-01-01 00:00:00.000
  
  SELECT CAST('' AS DATE);
  1900-01-01
  
  SELECT CAST(CAST(0 AS DATETIME) AS DATE);
  1900-01-01
  
  SELECT CAST(0 AS DATE);
  </code></pre>
  
  <blockquote>
    <p>Msg 529, Level 16, State 2, Line 4<br>
    Explicit conversion from data type int to date is not allowed.</p>
  </blockquote>
  
  <p>Why does the <code>CAST</code> from an empty string to <code>DATE</code> and <code>DATETIME</code> work, but from <code>0</code> it only works as <code>DATETIME</code>?</p>
  
  <p>I'm interested in a technical explanation</p>