title: How to set a DateTime variable in SQL Server 2008?
body: <p>SQL Server 2008 is not doing what I expected with <code>DateTime</code>. It doesn't let me set <code>DateTime</code> variables, no matter what date format I use.</p>
  
  <p>When I execute:</p>
  
  <pre><code>DECLARE @Test AS DATETIME
  SET @Test = 2011-02-15
  PRINT @Test
  </code></pre>
  
  <p>I get an output of:</p>
  
  <pre><code>Jun 18 1905 12:00AM
  </code></pre>
  
  <p>I've checked all of the regional settings that I can find &amp; it all appears okay. I've also tried setting the <code>DateTime</code> to various literal alternatives, such as '15/02/2011', '2011-02-15 00:00:00', etc.</p>