declare @ksrq datetime set @ksrq='2018-12-1' select dateadd(d,a.number,@ksrq) as 日期 from master..spt_values a where type = 'P' and dateadd(d,a.number,@ksrq) >= convert(varchar(7),@ksrq,120)+'-01' and dateadd(d,a.number,@ksrq) < convert(varchar(7),dateadd(mm,1,@ksrq),120)+'-01'
修改@ksrq的值就可以