declare @month int, @year int, @date datetime select @month = 2, @year = 2000 select @date = convert(varchar, @year) + right('0' + convert(varchar, @month), 2) + '01' select datediff(d, @date, dateadd(m, 1, @date)) as "Number of Days"
select dateadd( d, -1 , dateadd( m , 1 , @date ) ) AS "Last Day Of Month" |