SELECT TOP (100) PERCENT sj.name, sja.run_requested_date, CONVERT(VARCHAR(12), sja.stop_execution_date - sja.start_execution_date, 114) AS Duration, sj.job_id, sj.enabled
FROM msdb.dbo.sysjobactivity AS sja INNER JOIN
msdb.dbo.sysjobs AS sj ON sja.job_id = sj.job_id
WHERE (sja.run_requested_date IS NOT NULL) AND (CONVERT(VARCHAR(12), sja.stop_execution_date - sja.start_execution_date, 114) > CONVERT(VARCHAR(12), ‘00:00:02:000’, 114))
–and name in (‘Weixin_ServiceRequest_AutoSelect_FromERP’,‘ImportSelectContractItemFormERP_SP’)
ORDER BY sja.run_requested_date DESC
本文来源https://www.modb.pro/db/28433