Running successive jobs on SQL Server 2005

  • Good day,

    We would appreciate your help on the following issue concerning running jobs on SQL Server 2005. We are trying to run successive jobs through a query using the command EXEC MSDB.DBO.SP_START_JOB 'JOB NAME'. It would really arrange us to run the next job in the queue once the previous one is terminated successfully. We tried to use the MSDB.dbo.sysjobhistory system table to track the job history and execution status but had some difficulties handling the complex output . Can anyone help us out on it by providing a running script to solve this matter or any other convenient solution?

    Thank you

  • Why not create one job with all the steps calling next job on success and just run this one job from the command prompt.

    Facts are stubborn things, but statistics are more pliable - Mark Twain
    Carolyn
    SQLServerSpecialists[/url]

  • That sounds awfully cumbersome. I do what Carolyn suggested. Put all the jobs into 1 job as separate steps using the GUI, then send an email notification at the end.

    If you want to do it through T-Sql, get the job all set up through the GUI, then script it to a new query window to see all the commands that SQL is doing to generate the job.

    Scripting things (jobs, schema changes, backups ....) is useful because it helps you learn the code that's being run, and allows you to save the code for future reference and as documentation of what was run.

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

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