Tsql 递归构造连续日期序列

with t(d) as
(select GETDATE() union all select d +1 from t where d<GETDATE()+9)
select * from t

构造一个10天日期序列

 

with t(n,m) as
(select 1,getdate() union all select n+1,getdate()+n from t where n<10)
select m from t;

构造一个带序号的日期序列
原文地址:https://www.cnblogs.com/i80386/p/2269360.html