Temporarily stop and then restart jobs between Sat 9 pm and Sun 2 am

  • Here's a start but I don't know how to identify the days. Help? I then need to take this list and disable. Then restart the list on Sunday after 2 am. TIA!

    select

    sj.name as job_name,

    sjt.step_name,

    ss.name as schedule_name,

    ss.active_start_time

    ,ss.*

    from sysjobs sj

    join sysjobschedules sjs on sjs.job_id = sj.job_id

    join sysjobsteps sjt on sjt.job_id = sj.job_id

    JOIN sysschedules ss on ss.schedule_id = sjs.schedule_id

    where 1=1

    AND ss.enabled = 1 AND sj.enabled = 1

    and

    (

    ss.active_start_time >= 210000

    or

    ss.active_start_time <= 2000

    )

    order by sj.job_id, sj.start_step_id, sjs.schedule_id, sjs.next_run_date, sjt.step_id

    [font="Courier New"]ZenDada[/font]

  • I got partial answers from @sqldba and @SQLfool on #SQLhelp. Can hack my way from there. So NM.

    [font="Courier New"]ZenDada[/font]

  • ZenDada (12/13/2012)


    I got partial answers from @sqldba and @SQLfool on #SQLhelp. Can hack my way from there. So NM.

    Cool! Can you share the solution, please? Thanks.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply