Labels

CSOM (1) JavaScript (1) SharePoint (1)

Wednesday, October 4, 2017

Time Dimension T-SQL


Generating Time Dimention

with cte1 as(

select 1 as a from( values(1),(2)) as A(a)
cross join ( values(1),(2)) as B(b)
),
cte2 as( select 1 as x from cte1 as a cross join cte1
),cte3 as( select 1 as x from cte2 as a cross join cte2
),cte4 as( select 1 as x from cte3 as a cross join cte3
),CTE as( select ROW_NUMBER() over(order by (select 1)) as x from cte4)
select x,CONVERT (date, getdate()-x ) from CTE


No comments:

Post a Comment