Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2003

    Unanswered: get job name of current job

    I have a stored procedure that I run as a job. If it fails I want to disable the job.

    I would disable by

    exec msdb.dbo_spupdatetask job_name, @enabled=0

    Is there a way to obtain the job name of the current running job?

  2. #2
    Join Date
    Dec 2002
    You can get the current running jobs a couple of ways. First, you can

    select * from master..sysprocesses

    and parse through the program_name column looking for your job id or job step, and then by joining back to the msdb..sysjobs table, you can derive the name.

    or you can run the stored proc


    in the context of msdb and look at the current execution status column. a 1 means it is currently running.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts