DECLARE @WeekDays TABLE
(
Freq_interval INT,
Weekdays NVARCHAR (120)
)
INSERT into @WeekDays
SELECT 1, N ' Sunday ' UNION all
SELECT 2, N ' Monday ' UNION all
SELECT 4, N ' Tuesday ' UNION all
SELECT 8, N ' Wednesday ' UNION all
SELECT, N ' Thursday ' UNION all
SELECT, N ' Friday ' UNION all
SELECT, N ' Saturday ' UNION all
SELECT 3, N ' Sunday, one ' UNION all
SELECT 5, N ' Sunday, two ' UNION all
SELECT 9, N ' Sunday, Tri ' UNION all
SELECT, N ' Sunday, four ' UNION all
SELECT, N ' Sunday, five ' UNION all
SELECT, N ' Sunday, six ' UNION all
SELECT 6, N ' Monday, two ' UNION all
SELECT Ten, N ' Monday, Tri ' UNION all
SELECT, N ' Monday, four ' UNION all
SELECT, N ' Monday, V ' UNION all
SELECT, N ' Monday, six ' UNION all
SELECT, N ' Tuesday, Tri ' UNION all
SELECT, N ' Tuesday, four ' UNION all
SELECT, N ' Tuesday, V ' UNION all
SELECT, N ' Tuesday, six ' UNION all
SELECT, N ' Wednesday, four ' UNION all
SELECT, N ' Wednesday, five ' UNION all
SELECT, N ' Wednesday, six ' UNION all
SELECT, N ' Thursday, V ' UNION all
SELECT, N ' Thursday, six ' UNION all
SELECT, N ' Friday, six ' UNION all
SELECT 7, N ' Sunday, one, two ' UNION all
SELECT one, N ' Sunday, I, iii ' UNION all
SELECT, N ' Sunday, one, four ' UNION all
SELECT, N ' Sunday, one, five ' UNION all
SELECT, N ' Sunday, one, six ' UNION all
SELECT, N ' Sunday, two, tri ' UNION all
SELECT, N ' Sunday, two, four ' UNION all
SELECT PNs, N ' Sunday, two, five ' UNION all
SELECT, N ' Sunday, two, six ' UNION all
SELECT, N ' Sunday, three, four ' UNION all
SELECT, N ' Sunday, three, five ' UNION all
SELECT, N ' Sunday, three, six ' UNION all
SELECT, N ' Sunday, four, five ' UNION all
SELECT Bayi, N ' Sunday, four, six ' UNION all
SELECT $, N ' Sunday, five, six ' UNION all
SELECT, N ' Monday, two, tri ' UNION all
SELECT, N ' Monday, two, four ' UNION all
SELECT, N ' Monday, two, V ' UNION all
SELECT, N ' Monday, two, six ' UNION all
SELECT +, N ' Monday, three, four ' UNION all
SELECT, N ' Monday, three, five ' UNION all
SELECT A, N ' Monday, three, six ' UNION all
SELECT, N ' Monday, four, five ' UNION all
SELECT, N ' Monday, four, six ' UNION all
SELECT 98, N ' Monday, five, six ' UNION all
SELECT, N ' Tuesday, three, four ' UNION all
SELECT, N ' Tuesday, three, five ' UNION all
SELECT, N ' Tuesday, tri, vi ' UNION all
SELECT, N ' Tuesday, four, five ' UNION all
SELECT $, N ' Tuesday, four, six ' UNION all
SELECT, N ' Tuesday, five, six ' UNION all
SELECT four, N ' Wednesday,, five ' UNION all
SELECT, N ' Wednesday, four, six ' UNION all
SELECT 104, N ' Wednesday, five, six ' UNION all
SELECT, N ' Thursday, five, six ' UNION all
SELECT, N ' Sunday, one, two, tri ' UNION all
SELECT two, N ' Sunday, one,, four ' UNION all
SELECT two, N ' Sunday, one,, five ' UNION all
SELECT, N ' Sunday, one, two, six ' UNION all
SELECT, N ' Sunday, one, three, four ' UNION all
SELECT, N ' Sunday, one, three, five ' UNION all
SELECT, N ' Sunday, one, three, six ' UNION all
SELECT Wuyi, N ' Sunday, one, four, five ' UNION all
SELECT four, N ' Sunday, one,, six ' UNION all
SELECT, N ' Sunday, one, five, six ' UNION all
SELECT, N ' Sunday, two, tri, iv ' UNION all
SELECT, N ' Sunday, two, three, five ' UNION all
SELECT, N ' Sunday, two, three, six ' UNION all
SELECT, N ' Sunday, two, four, five ' UNION all
SELECT $, N ' Sunday, two, four, six ' UNION all
SELECT 101, N ' Sunday, two, five, six ' UNION all
SELECT four, N ' Sunday, three,, five ' UNION all
SELECT, N ' Sunday, three, four, six ' UNION all
SELECT, N ' Sunday, three, five, six ' UNION all
SELECT 113, N ' Sunday, four, five, six ' UNION all
SELECT, N ' Monday, two, three, four ' UNION all
SELECT, N ' Monday, two, three, five ' UNION all
SELECT, N ' Monday, two, tri, vi ' UNION all
SELECT si, N ' Monday, two, four, five ' UNION all
SELECT, N ' Monday, two, four, six ' UNION all
SELECT 102, N ' Monday, two, five, six ' UNION all
SELECT four, N ' Monday, three,, five ' UNION all
SELECT four, N ' Monday, three,, six ' UNION all
SELECT 106, N ' Monday, three, five, six ' UNION all
SELECT, N ' Monday, four, five, six ' UNION all
SELECT, N ' Tuesday, three, four, five ' UNION all
SELECT four, N ' Tuesday, three,, six ' UNION all
SELECT 108, N ' Tuesday, three, five, six ' UNION all
SELECT, N ' Tuesday, four, five, six ' UNION all
SELECT, N ' Wednesday, four, five, six ' UNION all
SELECT, N ' Sunday, one, two, three, four ' UNION all
SELECT A, N ' Sunday, one, two, three, five ' UNION all
SELECT, N ' Sunday, one, two, three, six ' UNION all
SELECT, N ' Sunday, one, two, four, five ' UNION all
SELECT, N ' Sunday, one, two, four, six ' UNION all
SELECT 103, N ' Sunday, one, two, five, six ' UNION all
SELECT four, N ' Sunday, one, three,, five ' UNION all
SELECT four, N ' Sunday, one, three,, six ' UNION all
SELECT 107, N ' Sunday, one, three, five, six ' UNION all
SELECT, N ' Sunday, one, four, five, six ' UNION all
SELECT four, N ' Sunday, two, three,, five ' UNION all
SELECT, N ' Sunday, two, three, four, six ' UNION all
SELECT 109, N ' Sunday, two, three, five, six ' UNION all
SELECT 117, N ' Sunday, two, four, five, six ' UNION all
SELECT 121, N ' Sunday, three, four, five, six ' UNION all
SELECT, N ' Monday, two, three, four, five ' UNION all
SELECT 94, N ' Monday, two, three, four, six ' UNION all
SELECT, N ' Monday, two, three, five, six ' UNION all
SELECT 118, N ' Monday, two, four, five, six ' UNION all
SELECT 122, N ' Monday, three, four, five, six ' UNION all
SELECT 124, N ' Tuesday, three, four, five, six ' UNION all
SELECT two, N ' Sunday, one,, three, four, five ' UNION all
SELECT, N ' Sunday, one, two, three, four, six ' UNION all
SELECT 111, N ' Sunday, one, two, three, five, six ' UNION all
SELECT 119, N ' Sunday, one, two, four, five, six ' UNION all
SELECT 123, N ' Sunday, one, three, four, five, six ' UNION all
SELECT, N ' Sunday, two, three, four, five, six ' UNION all
SELECT 126, N ' Monday, two, three, four, five, six ' UNION all
SELECT 127, N ' Sunday, one, two, three, four, five, six ';
SELECT d.job_id as job_id,
J.name as Job_name,
case where j.enabled =1 then N ' Enable '
ELSE N ' disable ' END as Job_staus,
Case time Freq_type=1 then N ' Run once '
When freq_type=4 and then N ' daily execution '
When Freq_type=8 and then N ' Weekly execution '
When freq_type=16 and then N ' monthly execution '
When freq_type=32 and then N ' monthly execution '
When freq_type=64 and then N ' agent service starts running '
When freq_type=128 and then N ' run when the computer is idle '
END as Freq_type,
case where freq_type=1 then N ' option meaningless '
When Freq_type=4 Then
(
Case when freq_subday_type=4
Then N ' every ' + CONVERT (NVARCHAR (4), freq_subday_interval) +n ' minutes to execute once '
When Freq_subday_type=8
Then N ' every ' + CONVERT (NVARCHAR (4), freq_subday_interval) +n ' hours to execute once '
ELSE N ' daily execution ' + CONVERT (NVARCHAR (4), freq_interval) + n ' Times '
END
)
When Freq_type=8 Then
(SELECT w.weekdays from @WeekDays w WHERE w.freq_interval= s.freq_interval
)
When freq_type=16 then n ' monthly ' + CONVERT (NVARCHAR (4), freq_interval) + N ' execution '
When freq_type=32 then n ' Monthly week ' + CONVERT (NVARCHAR (4), freq_interval) + N ' execute '
END as Freq_relative_interval,
Case when Freq_subday_type =1 and then N ' Specify time point to execute once '
When Freq_subday_type =2 then n ' every: ' + CAST (freq_subday_interval as VARCHAR (2)) + N ' second execution once '
When Freq_subday_type =4 and then n ' every: ' + CAST (freq_subday_interval as VARCHAR (2)) + N ' Split execution once '
When Freq_subday_type =8 then n ' every: ' + CAST (freq_subday_interval as VARCHAR (2)) + N ' hours to execute once '
END as Freq_subday_type,
Case Time Freq_subday_type =1 then N ' Start point: '
+ CAST (active_start_time/10000 as VARCHAR (2)) + N ' point '
+ CAST (active_start_time%10000/100 as VARCHAR (2)) + N ' min '
When Freq_subday_type =2 then N ' Start point: '
+ CAST (active_start_time/10000 as VARCHAR (2)) + N ' point '
+ CAST (active_start_time%10000/100 as VARCHAR (2)) + N ' min '
When Freq_subday_type =4 then N ' Start point: '
+ CAST (active_start_time/10000 as VARCHAR (2)) + N ' point '
+ CAST (active_start_time%10000/100 as VARCHAR (2)) + N ' min '
When Freq_subday_type =8 then N ' Start point: '
+ CAST (active_start_time/10000 as VARCHAR (2)) + N ' point '
+ CAST (active_start_time%10000/100 as VARCHAR (2)) + N ' min '
END as Job_start_time,
Case Time Freq_subday_type =1 then N ' End point: '
+ CAST (active_end_time/10000 as VARCHAR (2)) + N ' point '
+ CAST (active_end_time%10000/100 as VARCHAR (2)) + N ' min '
When Freq_subday_type =2 and then N ' End point: '
+ CAST (active_end_time/10000 as VARCHAR (2)) + N ' point '
+ CAST (active_end_time%10000/100 as VARCHAR (2)) + N ' min '
When Freq_subday_type =4 and then N ' End point: '
+ CAST (active_end_time/10000 as VARCHAR (2)) + N ' point '
+ CAST (active_end_time%10000/100 as VARCHAR (2)) + N ' min '
When Freq_subday_type =8 and then N ' End point: '
+ CAST (active_end_time/10000 as VARCHAR (2)) + N ' point '
+ CAST (active_end_time%10000/100 as VARCHAR (2)) + N ' min '
END as Job_end_time,
Freq_type,
Freq_interval,
Freq_subday_type,
Freq_subday_interval,
Active_start_date,
Active_start_time
From Msdb.dbo.sysschedules S
INNER JOIN msdb.dbo.sysjobschedules D on s.schedule_id=d.schedule_id
INNER JOIN msdb.dbo.sysjobs J on d.job_id = j.job_id
ORDER by J.name
Script View Agent Run