Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
WITH CTE_DatesTable
AS
(
SELECT CAST('10/25/2010' AS DATETIME) AS [Date]
UNION ALL
SELECT DATEADD(dd, 1, [Date])
FROM CTE_DatesTable
WHERE DATEPART(dw, DATEADD(dd, 1, [Date])) <= 4
)
SELECT TOP 1 DATEADD(dd, 7, [Date]) FROM CTE_DatesTable ORDER BY [Date] DESC
...
SELECT TOP 1 CASE
WHEN DATEPART(dw, [Date]) = 4 THEN DATEADD(dd, 14, [Date]) ELSE DATEADD(dd, 7, [Date]) END AS [Date] FROM CTE_DatesTable ORDER BY [Date] DESC
...