摘要:
declare @Year varchar(10),@Month varchar(10)set @Year=Convert(varchar,DATEPART(year,CONVERT(DATETIME,'2011-02-15')))set @Month=Convert(varchar,DATEPART(month,CONVERT(DATETIME,'2011-02-15')))select (DAY(dateadd(dd,-1,DATEADD(m,1,cast(@Year as varchar(4)) + '-' + cast(@Month as 阅读全文