How to identify the job running through SQLServer Agent using SQL?

-- List processes currently running through SQLServer Agent select spid, program_name, blocked from master..sysprocesses where program_name like 'SQLAgent%' spid program_name blocked ------ --------------------------------------------------------------------------------- ------- 148 SQLAgent - TSQL JobStep (Job 0x6CDB1221B7584941B63E44C95E805E43 : Step 1) 0 -- Using the Job from program_name in Step 1, find information on the job select job_id, name, description from msdb..sysjobs... Continue Reading →


How to see job owner, Email operator, Event Notification, Email Notification on jobs scheduled?

Using the SELECT statement below one can list notications that occur for jobs scheduled on SQLServer. SELECT --Job name As JobName, --Job owner SUSER_SNAME(sj.owner_sid) As owner, --Job category e.g. "Database Maintenance", "Report Server", "[Uncategorized (Local)]" as Category, --Operator to be e-mailed (may be NULL) as EmailOperator, --notification in Event log (notify when... Continue Reading →

How to see history of jobs scheduled in SQL Server?

Information on sysjobhistory Information on sysjobs -- shows job history with the most recent one to show the most recent one with it's run status select job_name, run_datetime, run_duration, run_status from ( select job_name, run_datetime, SUBSTRING(run_duration, 1, 2) + ':' + SUBSTRING(run_duration, 3, 2) + ':' + SUBSTRING(run_duration, 5, 2) AS run_duration, run_status from (... Continue Reading →

Blog at

Up ↑