working with MSSQL Dates


--no of days in the current month

select datediff(d,getdate(),dateadd(m,1,getdate()))


--last date of the month

SELECT DATEADD(ms, -5, DATEADD(mm, DATEDIFF(m, 0, GETDATE()) + 1, 0))

Comments