日期:2014-05-17 浏览次数:20565 次
declare @fyear as int,@fmonth as int set @fyear=2012 set @fmonth=9 select convert(varchar(7),dateadd(mm,-1,ltrim(@fyear)+'-'+ltrim(@fmonth)+'-01'),120)
------解决方案--------------------
declare @fyear as int,@fmonth as int set @fyear=2012 set @fmonth=9 SELECT DATEADD(mm,-1,LTRIM(@fyear)+'-'+LTRIM(@fmonth)+'-01') SELECT DATEADD(mm,-2,LTRIM(@fyear)+'-'+LTRIM(@fmonth)+'-01')