T-sql 递归构造连续日期序列

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;

构造一个带序号的日期序列

 

 

posted on 2011-11-30 16:55  雨渐渐  阅读(305)  评论(0编辑  收藏  举报

导航