Skip to content

Instantly share code, notes, and snippets.

@petesql
Last active October 27, 2022 13:32
Show Gist options
  • Save petesql/662232a7e83440f32432d1c31cf7d391 to your computer and use it in GitHub Desktop.
Save petesql/662232a7e83440f32432d1c31cf7d391 to your computer and use it in GitHub Desktop.
-- list all sql agent jobs on instance
SELECT
j.job_id,
j.name, j.description,
j.enabled,
s.step_id, s.step_name, s.database_name, s.subsystem, s.command,
j.date_created, j.date_modified,
s.on_success_action, s.on_fail_action, s.retry_attempts, s.retry_interval,
s.last_run_outcome, s.last_run_duration, s.last_run_date, s.last_run_time
FROM msdb.dbo.sysjobs j WITH (NOLOCK)
INNER JOIN msdb.dbo.sysjobsteps s WITH (NOLOCK)
ON j.job_id = s.job_id
@petesql
Copy link
Author

petesql commented Oct 26, 2022

I have a blog post using this script:
July 21, 2022, List All SQL Agent Jobs on a SQL Server Instance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment