May 112009
 

I remember searching for this T-SQL statement a few months ago, so time to put it on the blog.

--GET FIRST DAY OF LAST MONTH 
SELECT DATEADD(MM, DATEDIFF(MM, '01/01/2000', DATEADD(MM, -1,GETDATE())), '01/01/2000') as [Date of First Day of Last Month]
--GET LAST DAY OF LAST MONTH 
SELECT DATEADD(SS,-1,DATEADD(MM, DATEDIFF(MM,'01/01/2000',GETDATE()),'01/01/2000')) as [Date of Last Day of Last Month]