SQL - How to find currently running job steps through TSQL -


i writing query find running job in sql (i know can view in job active monitor, i've need in tsql). though can query sysjobactivity table find running job, it's telling job step running (because job might have more 1 step).

query used:

select s.name [job_name],        '' [step_id],         '' step_name,         'processing' status,         sja.run_requested_date start_time,         null end_date,        convert(varchar, (getdate() - sja.run_requested_date), 8) duration    sysjobactivity sja, sysjobs s  sja.job_id = s.job_id    , sja.run_requested_date >  getdate() - 1    , sja.stop_execution_date null 

please me finding step id & step name in job progressing.

i think below script sql jobs current execution step, try this

msdb.dbo.sp_help_job @execution_status = 1 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -