I\'ve seen different version of this kind of function for other coding languages (Python, jQuery, etc.) but not for SQL. I have a procedure that needs to have a date calcul
Assuming we have a DateTable with columns actual_date (date)
and is_holiday (bit)
, containing all dates and where all workdays have is_holiday=0:
SELECT actual_date from
(
SELECT actual_date, ROW_NUMBER() OVER(ORDER BY actual_date) AS Row
FROM DateTable
WHERE is_holiday= 0 and actual_date > '2013-12-01'
) X
WHERE row = 65
This will find 2013-12-01 plus 65 workdays, skipping holidays.