Thursday, March 29, 2012
SQL Jobs with Multiple schedules
use msdb
go
/*
select * from sysjobs
select * from sysjobschedules
*/
select a.job_id , a.name, COUNT(*)
from sysjobs a
inner join sysjobschedules b on a.job_id = b.job_id
group by a.job_id , a.name
having COUNT(*) > 1
select c.name, b.*, a.*
from sysschedules a
inner join sysjobschedules b on a.schedule_id = b.schedule_id
inner join sysjobs c on c.job_id = b.job_id
where a.schedule_id in
(
select schedule_id from sysjobschedules
where job_id in
(
select a.job_id
from sysjobs a
inner join sysjobschedules b on a.job_id = b.job_id
group by a.job_id , a.name
having COUNT(*) > 1
)
)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment