title: How can I select the first day of a month in SQL?
body: <p>I just need to select the first day of the month of a given DateTime variable.</p>
  <p>I know it's quite easy to do using this kind of code:</p>
  <pre><code>select CAST(CAST(YEAR(@mydate) AS VARCHAR(4)) 
  + '/' + CAST(MONTH(@mydate) AS VARCHAR(2)) + '/01' AS DATETIME)
  </code></pre>
  <p>But unfortunately, this is not very elegant, and not very fast either.</p>
  <p>Is there a better way to do this? I'm using SQL Server 2008.</p>