I get this error:
The maximum recursion 100 has been exhausted before statement completion
when I run this function:
WITH allDays AS (
SELECT @DateEarly AS date
UNION ALL
SELECT DATEADD(dd, 1, date) as date
FROM allDays s
WHERE DATEADD(dd, 1, date) <= @DateLate
)
SELECT *
from allDays
where dbo.isFestivo(date)>0
I tried to append this option:
OPTION (MAXRECURSION 200);
but i get an error 156 before "option" word. Do you know why?