--万能sql
select convert(varchar(7),dateadd(mm,-number,getdate()),23) as d
from master..spt_values
where type='p' and number >=0 and number<=5
and convert(varchar(7),dateadd(mm, -6 ,getdate()),23) between convert(varchar(7),dateadd(mm, -6 ,getdate()),23) and convert(varchar(7),dateadd(mm, 0 ,getdate()),23)