SET DATEFIRST 1; DECLARE @sDate date DECLARE @eDate date;...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Android Enthusiasts Meta

Q&A about the site for enthusiasts and power users of the Android operating system

SET DATEFIRST 1;
DECLARE @sDate date
DECLARE @eDate date;
DECLARE @noModificationYears nvarchar(max);
DECLARE @Count int;
SET @sDate = '2020-01-01';
SET @eDate = '2020-12-31';
SET @noModificationYears = '2018,2024,2029,2035';
SET @Count = 1;
with CTE1 As  
(  
    Select DATEADD(day, 0, @sDate) as TheDate, 'D' as PERIND
    UNION ALL  
    Select DATEADD(day, 1, TheDate) as TheDate, 'D' as PERIND from CTE1  
    where TheDate < @eDate 
),
CTE2 As
(
  Select c1.TheDate, 'W' as PERIND from CTE1 c1
  UNION ALL
  Select DATEADD(day, 0, c2.TheDate) as TheDate, 'W' as PERIND from CTE1 c2
)

SELECT * FROM CTE2 option (maxrecursion 0);

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results