var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
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?
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.