I am trying to find a way to execute a maintenance job from script and have it return if the the job was successful or not. I know that I can use msdb.dbo.sp_start_job to execute the maintenance job, but it will only kick it off with out returning if it was successful or not.

My ultimate goal for this is we use JAMS for all our job scheduling and we want to only need to check there for any job failures.

  • Jobs are asynchronous. If you want your script to find out the status of the work after it's done, stop using jobs. Feb 10, 2015 at 17:03

1 Answer 1


If your end goal is to use JAMS, then it handles many of the SQL agent job conversions for you.

JAMS includes a native conversion utility for SQL Agent jobs to streamline the transition your organization’s transition to enterprise scheduling. Comprehensive mapping preserves the SQL Agent logic you’ve created and extends each job with an array of properties for advanced scheduling.

Taken from http://www.jamsscheduler.com/platforms/sql-databases/

  • Thanks! Once we get it set up in our dev environment. I'll look into using that feature. Fortunately, in the mean time most of our maintenance plans are simple enough to convert to scripts.
    – Eric S
    Feb 12, 2015 at 14:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.