Thanks Dieter. That stopped the 3706 error. Now I have another. "2666 Invalid date supplied for NJSHoliday.Holiday." Below is the full code I am runnning. I am posting this here now (so I won't forget later) and will continue to troubleshoot on my own. I will post if anything changes.
Thanks again for your help; I'm learning a lot.
God Bless,
Genesius
WITH cte (DoY, OrigDueDate, DoW, Hol, NewDueDate) AS
(SELECT
SCC.Day_of_Year AS DoY,
SCC.Calendar_Date AS OrigDueDate,
SCC.Day_Of_Week AS DoW,
HC.Holiday AS Hol,
MIN(CASE WHEN DoW /*SCC.Day_Of_Week*/ IN (1,7) OR Hol /*HC.Holiday*/ IS NOT NULL
THEN NULL
ELSE OrigDueDate /*calendar_date*/ END)
OVER (ORDER BY OrigDueDate /*calendar_date*/ ROWS BETWEEN CURRENT ROW
AND UNBOUNDED FOLLOWING) AS NewDueDate
FROM SYS_CALENDAR.CALENDAR AS SCC
LEFT JOIN NJSHolidayCalendar AS HC
ON OrigDueDate /*SCC.Calendar_Date*/ = Hol /*HC.Holiday*/
WHERE SCC.Year_Of_Calendar = '2015')
SELECT
t1.*,
t2.OrigDueDate /*Calendar_date*/ AS OrigGracePeriodEndDate,
t2.DoW /*Day_Of_Week*/ AS OrigGracePeriodEndDateDoW,
t2.NewDueDate AS NewGracePeriodEnd,
Day_Of_Week(NewGracePeriodEnd) AS NewGracePeriodEndDateDoW
FROM cte AS t1
LEFT JOIN cte AS t2
ON t2.OrigDueDate /*calendar_date*/ = t1.NewDueDate + 45
;
Thanks Dieter. That stopped the 3706 error. Now I have another. "2666 Invalid date supplied for NJSHoliday.Holiday." Below is the full code I am runnning. I am posting this here now (so I won't forget later) and will continue to troubleshoot on my own. I will post if anything changes.
Thanks again for your help; I'm learning a lot.
God Bless,
Genesius