In this post I will explain how to get first and last date of month. DECLARE @mydate DATETIME SELECT @mydate = GETDATE() SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(@mydate)-1),@mydate),103) AS Date_Value, 'First Day OF Current Month' AS Date_Type UNION SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(DATEADD(mm,1,@mydate))),DATEADD(mm,1,@mydate)),103) , 'Last Day of Current Month' GO
Here you can find solution of your code problem & errors.