Viewing 3 posts - 1 through 3 (of 3 total)
I'm not sure what you mean.
"SELECT * FROM days" will fail because of recursion limit. But original idea was to get only the first Friday, the 13th. As there...
August 27, 2009 at 4:48 am
#1045421
"UNION ALL" is a requirement in CTE
August 27, 2009 at 3:59 am
#1045397
How about set-based approach:
SET DATEFIRST 1
;WITH days(Date) AS
(
--Get 13th of this month
SELECT CAST(CAST(YEAR(GETDATE()) AS VARCHAR(4)) + '-' + CAST(MONTH(GETDATE()) AS VARCHAR(2)) + '-13' AS DATETIME)
UNION ALL
--Get 13th of next...
August 27, 2009 at 12:38 am
#1045348