Friday, March 23, 2012

Job Schedule

I would like to view all the scheduled jobs , sorted by Next Run Date. When
I use Enterprise Manager and sort by that column, they are not sorted
correctly.
Suggestions?Hopefully following query can give you the required result.
select sj.name, sj.description,
case sj.enabled
when 0 then 'Enabled'
else 'Disabled' end as 'Job Status',
sjs.next_run_date,
right('000000' + convert(varchar(6),sjs.next_run_time),6) 'Next Run Time'
from msdb.dbo.sysjobs sj, msdb.dbo.sysjobschedules sjs
where sj.job_id = sjs.job_id
order by sjs.next_run_date, sjs.next_run_time
Please let us know whether this helped you or not?
"John Carlton" wrote:
> I would like to view all the scheduled jobs , sorted by Next Run Date. When
> I use Enterprise Manager and sort by that column, they are not sorted
> correctly.
> Suggestions?|||Yes, perfect. Thanks!
"Absar Ahmad" wrote:
> Hopefully following query can give you the required result.
> select sj.name, sj.description,
> case sj.enabled
> when 0 then 'Enabled'
> else 'Disabled' end as 'Job Status',
> sjs.next_run_date,
> right('000000' + convert(varchar(6),sjs.next_run_time),6) 'Next Run Time'
> from msdb.dbo.sysjobs sj, msdb.dbo.sysjobschedules sjs
> where sj.job_id = sjs.job_id
> order by sjs.next_run_date, sjs.next_run_time
> Please let us know whether this helped you or not?
> "John Carlton" wrote:
> > I would like to view all the scheduled jobs , sorted by Next Run Date. When
> > I use Enterprise Manager and sort by that column, they are not sorted
> > correctly.
> > Suggestions?

No comments:

Post a Comment