Search code examples
sql-serversql-job

SQL JOB schedule: how to skip certain month


I need a report that runs once on the following month below: JAN,FEB,APR,MAY,JUL,AUG,OCT,NOV (essentially skipping MAR, JUN, SEP and DEC)

and this is how I do it (I had to have two schedules to achieve it: See screenshot below). and My question does my two-schedule method will get me what I need? is there a better way? Will this still work in 2024, 2025 and so on?

thanks

The only difference between the schedule is the start date.

THE FIRST Schedule ( I am hoping this report will run on JAN APR JUL OCT)

THE FIRST Schedule

The second Schedule: ( And the second schedule, I am hoping it will run on FEB MAY AUG NOV)

The second Schedule


Solution

  • Simply have a single job that executes monthly and in the t-sql job step

    if month(getdate()) in (1,2,4,5,7,8,10,11)
    begin
      exec...
    end