Ad Code

How to Get SQL Server Agent Jobs List with Schedule in SQL Server

Get SQL Server Agent Jobs List with Schedule in SQL Server

We'll receive a list of SQL Server Agent Jobs with schedules in this post. The MSDB database's system tables will be used. 

1.     Sys.SysJobs

2.     Sys.SysSchedules

3.     Sys.SysJobSchedules

The SQL Server Agent Jobs list with schedules can be fetched using the script below.

USE msdb
GO
 
SELECT Job.name        AS JobName,
       
CASE
         
WHEN Job.enabled THEN 'Enable'
         
ELSE 'Disable'
       
END             AS JobStatus,
       
JOB.description AS Job_Description,
       
SCH.name        AS ScheduleName,
       
CASE
         
WHEN SCH.enabled THEN 'Enable'
         
WHEN SCH.enabled THEN 'Disable'
         
ELSE 'Not Schedule'
       
END             AS ScheduleStatus,
       
SCH.active_start_date,
       
SCH.active_end_date,
       
SCH.active_start_time,
       
SCH.active_end_time
 FROM   dbo.sysjobs JOB
      
LEFT JOIN dbo.sysjobschedules JS
               
ON Job.job_id JS.job_id
       
LEFT JOIN dbo.sysschedules SCH
               
ON JS.schedule_id SCH.schedule_id

 

Post a Comment

0 Comments

Close Menu