Find a SQL Job from an JobStepID

Looking through Waits in my MDW I often see things like …

Program Name: SQLAgent- TSQL JobStep (Job 0xD56…

… and can get the job name from …

SELECT * 
FROM msdb.dbo.sysjobs
WHERE job_id = 0xD56...

Or even better! to go directly from the JobStep-ID to the Executable causing the issue …

SELECT * 
FROM msdb.dbo.sysjobsteps
WHERE job_id = 0xD56...

Leave a comment