sql server - sql agent job run_status = 0 even if "Quit the job reporting success" -
we using ms scom monitor result of ms sql agent jobs. currently error if step of job failed. developers says wrong , should alert if whole job fails, if steps not working ok i create test job 1 step result error. lets find job , results: select j.name, j.job_id, jh.step_id, jh.step_name, jh.run_status, case jh.run_status when 0 'failed' when 1 'succeeded' when 2 'retry' when 3 'canceled' when 4 'running' else 'unknown' end run_statusstring, j.enabled, jh.message, msdb.dbo.agent_datetime( case when jh.run_date = 0 null else jh.run_date end, case when jh.run_time = 0 null else jh.run_time end) last_runtime msdb.dbo.sysjobhistory jh inner join ( select distinct jh.job_id, max(jh.instance_id) instance_id msdb.dbo.sysjobhistory jh jh.step_id != 0 group jh.job_id ) on jh.job_id = a.job_id , a.instance_id = jh.in...