Created
May 13, 2022 15:41
-
-
Save Otterpohl/955c658c08ef1543c7d044030327d220 to your computer and use it in GitHub Desktop.
Gets the schedules for all agent jobs
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 CASE (ss.freq_subday_type) | |
WHEN 1 then left(stuff((stuff((replicate('0', 6 - len(ss.active_start_time)))+ convert(varchar(6),ss.active_start_time),3,0,':')),6,0,':'),8) | |
WHEN 2 then 'Every ' + convert(varchar(10),ss.freq_subday_interval) + ' seconds' | |
WHEN 4 then 'Every ' + convert(varchar(10),ss.freq_subday_interval) + ' minutes' | |
WHEN 8 then 'Every ' + convert(varchar(10),ss.freq_subday_interval) + ' hours' | |
ELSE '??' | |
END AS [Time], | |
s.Name | |
from msdb.dbo.sysjobs AS s | |
left join msdb.dbo.sysjobschedules AS sj on S.job_id = SJ.job_id | |
left join msdb.dbo.sysschedules AS ss on SS.schedule_id = SJ.schedule_id | |
order by S.name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment