日期:2014-05-18 浏览次数:20398 次
declare @start datetime declare @end datetime set @start = '2008-01-01' set @end = '2012-12-01' ;with cte as ( select convert(varchar(6),dateadd(mm,number,@start),112) as date from master..spt_values where [type] = 'P' and number between 0 and datediff(mm,@start,@end) ) select * from cte