Created
May 13, 2022 15:43
-
-
Save Otterpohl/14c4d9c1542e88a2a46dc6c611901c59 to your computer and use it in GitHub Desktop.
Get agent jobs with the same execution time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT j.name, | |
j.description, | |
a.start_execution_date | |
FROM msdb.dbo.sysjobs AS j | |
INNER JOIN msdb.dbo.sysjobactivity AS a | |
ON j.job_id = a.job_id | |
WHERE a.start_execution_date > DATEADD(dd, -14, GETDATE()) | |
AND j.enabled = 1 | |
AND a.start_execution_date IN | |
( | |
SELECT start_execution_date | |
FROM msdb.dbo.sysjobactivity | |
WHERE start_execution_date > DATEADD(dd, -14, GETDATE()) | |
GROUP BY start_execution_date | |
HAVING COUNT(*) > 1 | |
) | |
ORDER BY a.start_execution_date; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment