How to find the number of Fridays, Sundays, and Saturdays between two given dates..?
I have a Weekly Pull (FRI, SAT, SUN) to run every week deleting all 2018 and load all 2018 only Fri, sat, sun.
I have below query which can get only <g class="gr_ gr_27 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del" data-gr-id="27" id="27">SAT</g> and sun.
select @Start_date = '20120801', @end_Date = '20120830'
; WITH Date_Result(DateofWeek) AS (
Select @Start_date Fecha
UNION ALL
SELECT DATEADD(day, 1, date of a week) Dateofweek
FROM Date_Result
WHERE DateofWeek < @end_date
)
select Dateofweek from Date_result where DATEPART(DW, Dateofweek)in (1,7)
OPTION (MaxRecursion 0);
I want to get Friday, Saturday, Sunday and use SQL Task Editor and pass the variables start and end date.
Help...