Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Otterpohl/14c4d9c1542e88a2a46dc6c611901c59 to your computer and use it in GitHub Desktop.
Save Otterpohl/14c4d9c1542e88a2a46dc6c611901c59 to your computer and use it in GitHub Desktop.
Get agent jobs with the same execution time
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