I only need to choose the given DateTime variable's first day of the given month.
I am aware that utilizing this type of code makes it relatively simple to do:
select CAST(CAST(YEAR(@mydate) AS VARCHAR(4))
+ '/' + CAST(MONTH(@mydate) AS VARCHAR(2)) + '/01' AS DATETIME)
However, this is regrettably not very elegant and neither is it very quick.
Is there a more effective approach to this? Using SQL Server 2008, please.