I still prefer the following to get to the first of the month:
SET @dt = DATEADD(d,1-DAY(@dt),@dt)
Nigel, nice! Your arithmetic is very crafty and gets a solution in a single statement. But I always prefer code that is easily understood and maintainable by the programmers that come after me, even if there are a couple extra lines and temporary variables.
When I am working on a problem I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong.
— R. Buckminster Fuller
(from Code Complete, 2nd Edition, www.cc2e.com)