Search
 
SCRIPT & CODE EXAMPLE
 

SQL

ms sql how to see active job current run time

SELECT
    ja.job_id,
    j.name AS job_name,
    ja.start_execution_date,      
    ISNULL(last_executed_step_id,0)+1 AS current_executed_step_id,
    Js.step_name
FROM msdb.dbo.sysjobactivity ja 
LEFT JOIN msdb.dbo.sysjobhistory jh 
    ON ja.job_history_id = jh.instance_id
JOIN msdb.dbo.sysjobs j 
ON ja.job_id = j.job_id
JOIN msdb.dbo.sysjobsteps js
    ON ja.job_id = js.job_id
    AND ISNULL(ja.last_executed_step_id,0)+1 = js.step_id
WHERE ja.session_id = (SELECT TOP 1 session_id FROM msdb.dbo.syssessions ORDER BY agent_start_date DESC)
AND start_execution_date is not null
AND stop_execution_date is null;
Comment

PREVIOUS NEXT
Code Example
Sql :: oracle sql query to make column data uppercase 
Sql :: oracle list invalid password ORA-01017 
Sql :: Erreur SQL sur la requête Index column size too large. The maximum column size is 767 bytes. 
Sql :: set username and password for postgresql database 
Sql :: sqlite show columns in table 
Sql :: how to see logical reads in sql server 
Sql :: check mysql timezone 
Sql :: oracle alert log location 
Sql :: cross schema query oracle 2 users 
Sql :: check sql database table lock 
Sql :: monthname sql 
Sql :: error code 1292 mysql workbench 
Sql :: setVal pgsql 
Sql :: check constraint to check if date greater than todays date 
Sql :: postgresql update to unique 
Sql :: sql set no lmit 
Sql :: postgres show current role 
Sql :: rows to comma separated values in mssql 
Sql :: set all the vluses in calumn in sql to false 
Sql :: sql sort column by date 
Sql :: how to get table structure in sql server 
Sql :: oracle add month 
Sql :: drop all foreign key constraints mysql 
Sql :: set auto increment from 1 
Sql :: sql select only time from datetime 
Sql :: sql cast to integer 
Sql :: how to select all attributes from a row if there is a certain string in it MySQL 
Sql :: grant mysql 
Sql :: SELECT NUMBER OF rows for all tables oracle 
Sql :: where clause for child record apex 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =