• Include a JOIN to msdb.dbo.sysjobactivity and ORDER BY the run_requested_date DESC - it will return 0 for any job step that is currently executing - example: (SELECT TOP 1 ISNULL(last_executed_step_id, 0)

    FROM msdb.dbo.sysjobactivity

    WHERE job_id = @JobID

    ORDER BY run_requested_date DESC )

    ______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience