Hi
I have a question. I want to return all weekend days in SQL for my form validation.
This is my SQL Code that returns these days, but only for the current month:
WITH Dates AS (
SELECT CAST(DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE()), 0) AS DATE) AS DateValue
UNION ALL
SELECT DATEADD(DAY, 1, DateValue)
FROM Dates
WHERE DATEADD(DAY, 1, DateValue) < DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE()) + 1, 0)
)
SELECT DateValue
FROM Dates
WHERE DATEPART(WEEKDAY, DateValue) IN (1, 7)
OPTION (MAXRECURSION 0);
It only returns the weekends in the current month (July). But that scenario happens only in SSMS.
Webcon has problem reading it and won't make it work.
What I want to achieve is to do an If statement inside style and behaviour to check whether the day provided in the form is a weekend or not.
If is the weekend, then false, if not then true.