Sqlserver2008下利用递归CTE生成连续日期

with
temp as (select convert(datetime,'20120101') days),
n as
(
select days from temp
union all
select n.days+1 from n where n.days)
select * from n option(maxrecursion 32767)

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/2281175/viewspace-747022/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/2281175/viewspace-747022/

你可能感兴趣的:(Sqlserver2008下利用递归CTE生成连续日期)