• For the first day of the month, why use the double negative -- why not just

    dateadd(day,1-datepart(day,@d),@d)