I need to run a job every day 16. But if it is "saturday" or "sunday" it must run in the next business day.
I don't care if it is holidays or not. I just need to run it.
I could do something like this and separete it on steps, and only pass to the next step if it runs with no error:
--Step 1 - Verify if it is 16
IF day(getdate()) <> 16
RAISERROR ('Job runs only day 16.',16,1)
--Step 2 - verify if its saturday of sunday
IF DATEPART(weekday,getdate()) IN ( 7,1 )
RAISERROR ('Job will run on the next business day.',16,1)
I would create 2 steps with these queries, but this is not going to work since, lets say the next business day is 18, the first step will raise an error.
Is there a way to schedule something like this?