Wanted help in code for below logic.
- Job A needs to be run on 8th of month.
- Job B needs to be run on Tuesday only.
- Job c needs to be run on Daily(Minus Tuesday & Sunday).
And If Its Tuesday and 8Th Job A takes the precedence of Job.
i have coded logic for half of it.
Else If Begin logic,
--Tuesday Logic(0=Monday,1=Tuesday,2=Wed,3=Thu,4=Friday,5=Saturday,6=Sunday)
IF (SELECT DATEADD(dd,DATEDIFF(dd,0,GETDATE())/7*7,0) + 1)=1 -- If it is tuesday execute the Weekly+Daily Job
Print 'executing weekly and daily tables'
ELSE
BEGIN
Print 'executing daily job'
END
END
Best Answer
Here is my logic: