how I find if a job is running or not?

  • Hello

    I have to detect if a job is running before I decide to start it or not.

    I have checked the job tables in msdb and I cannot find the field modified by the status of the job at one point in time.

    I will appreciate your help.

    Lavi

  • Are you looking to do it manually or through a script?

    Manually, you can use Enterprise Manager and go to Management > SQL Agent > Jobs right-click on the job and select refresh. The job status will show you the status and date/time in the Last Run Status column.

    -SQLBill

  • Sorry for confusion.I want to run a script that must start jobs in function of a trigger in another database.

    That is if job is not alive then start job, else ( some other conditions...) start /stop job ...etc.

    I need to have a 'job director' to coordonate all my jobs in functions of some triggers...

    Thanks.

    Lavi

  • Try something like this, and insert results into a table then test the current_execution_status.

    exec msdb..sp_help_job @job_name = '<yourjob>', @job_aspect = N'job'

    Gregory Larsen, DBA

    If you looking for SQL Server Examples check out my website at http://www.geocities.com/sqlserverexamples

    Gregory A. Larsen, MVP

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

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