title: Create a date from day month and year with T-SQL
body: <p>I am trying to convert a date with individual parts such as 12, 1, 2007 into a datetime in SQL Server 2005. I have tried the following:</p>
  
  <pre><code>CAST(DATEPART(year, DATE)+'-'+ DATEPART(month, DATE) +'-'+ DATEPART(day, DATE) AS DATETIME)
  </code></pre>
  
  <p>but this results in the wrong date. What is the correct way to turn the three date values into a proper datetime format.</p>