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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 Script Library
 List Scheduled Jobs
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

8 Posts

Posted - 03/30/2004 :  13:14:56  Show Profile  Reply with Quote
DISPLAYS scheduled jobs ordered by date and time.
I couldn't find a SP to do this so I borrowed some code from

Louis Nguyen

CREATE PROCEDURE UtilityJobsSchedule
set nocount on
set transaction isolation level read uncommitted

create table #T(
job_id uniqueidentifier,
a2 varchar(100),
a3 varchar(100),
nextrundate varchar(100),
nextruntime varchar(100),
a6 varchar(100),
a7 varchar(100),
a8 varchar(100),
a9 varchar(100),
a10 varchar(100),
a11 varchar(100),
a12 varchar(100),
a13 varchar(100)

DECLARE @is_sysadmin INT
DECLARE @job_owner sysname
SELECT @is_sysadmin = ISNULL(IS_SRVROLEMEMBER(N'sysadmin'), 0)
SELECT @job_owner = SUSER_SNAME()
EXECUTE master.dbo.xp_sqlagent_enum_jobs @is_sysadmin, @job_owner

nextruntime=case when len(fj.nextruntime) > 3 then substring(fj.nextruntime,1,len(fj.nextruntime)-2) else fj.nextruntime end
FROM #T fj
JOIN msdb.dbo.sysjobs_view sjv ON (fj.job_id = sjv.job_id and sjv.enabled=1)
ORDER BY fj.nextrundate,
cast(case when len(fj.nextruntime) > 3 then substring(fj.nextruntime,1,len(fj.nextruntime)-2) else fj.nextruntime end as int)

  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000