I have a group of sql agent jobs, they all run a very simple SSIS package which extracts some data, creates an xls file and FTPs it to a local server. Everything is fine with all of them and the file is created.
When I was looking at the history of the jobs I noticed one of them had a step that had a play button icon against it rather than the green tick.
When I ran this query.....
select j.name as 'JobName', s.step_id as 'Step', s.step_name as 'StepName', h.run_status as 'Run status', msdb.dbo.agent_datetime(run_date, run_time) as 'RunDateTime', ((run_duration/10000*3600 + (run_duration/100)%100*60 + run_duration%100 + 31 ) / 60) as 'RunDurationMinutes' From msdb.dbo.sysjobs j INNER JOIN msdb.dbo.sysjobsteps s ON j.job_id = s.job_id INNER JOIN msdb.dbo.sysjobhistory h ON s.job_id = h.job_id AND s.step_id = h.step_id AND h.step_id <> 0 where j.enabled = 1 --Only Enabled Jobs and h.run_status > 2 order by JobName, RunDateTime desc
I saw that this particular job had a run status of 4... which means in progress.
How can this be? The step is set to complete and report success and the runtime says 0 minutes (it only takes seconds) all the other jobs that are almost identical do not exhibit this.
Another thing I notice is that in the job history this particular job shows 3 steps.... as shown in this image