Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Query to Select Job Schedules and Intervals

Author  Topic 

jbates99
Constraint Violating Yak Guru

396 Posts

Posted - 2011-02-17 : 18:22:00
Hello everyone,

I built this query to report the job schedules:

SELECT TOP (100) a.name as 'Job Name', b.next_run_date as 'Sched Date', b.next_run_time as 'Sched Time'
FROM msdb.dbo.sysjobs AS a INNER JOIN
msdb.dbo.sysjobschedules AS b ON a.job_id = b.job_id
WHERE (a.enabled = 1)
ORDER BY b.next_run_date, b.next_run_time;

A few jobs run at 15 minute intervals and I want to include Interval in the report. The sysjobschedules table doesn't contain the interval.

Can anyone tell me where the schedule interval is stored please?

Thanks, John

sql_server_dba
Posting Yak Master

167 Posts

Posted - 2011-02-17 : 19:19:14
try looking it in msdb.dbo.sysschedules
Go to Top of Page

jbates99
Constraint Violating Yak Guru

396 Posts

Posted - 2011-02-17 : 22:14:51
quote:
Originally posted by sql_server_dba

try looking it in msdb.dbo.sysschedules



That's it, Sql_server_dba. Thanks.

By joining msdb.dbo.sysschedules + sysjobschedules + sysjobs I can get job name, schedule and the Interval.

John
Go to Top of Page
   

- Advertisement -