473,586 Members | 2,491 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Find all jobs scheduled between two dates

1 New Member
Hi all, I'm trying to find a way to list all the jobs/schedules due to run between two dates but all I seem to be able to get is a list of jobs with their NextRunTime.

Example:
Say I had two jobs. The first job runs hourly on the hour and the second runs daily at 2pm.

Now if it was now (26 Jan 2007 11:20am) and I want to find out what jobs will run between 12pm and 4pm on 1st Feb 2007, I would want a list something like this:

JobID | RunTime
-----------------------------------
1 | 1 Jan 2007 12:00
1 | 1 Jan 2007 13:00
1 | 1 Jan 2007 14:00
2 | 1 Jan 2007 14:00
1 | 1 Jan 2007 15:00
1 | 1 Jan 2007 16:00

using enterprise manager I can only see the next run date so it would look like this:
JobID | RunTime
-----------------------------------
1 | 26 Jan 2007 12:00
2 | 26 Jan 2007 14:00

To me this seems like it would be something that would be really useful for a lot of people, especially DBAs needing to do server maintenance so I would be surprised if it hasn't been done before but I can't seem to a way anywhere. I don't really want to go to third party tools if I can avoid it, with the schedule definitions stored in the database it seems like it would be possible with a stored procedure that took two dates as parameters.

In the end I may need to create my own but as I said before it seems like such a useful SP that someone would have already done it and I'd rather not re-invent the wheel.

Regards,
Eamon
Jan 26 '07 #1
2 6669
iburyak
1,017 Recognized Expert Top Contributor
Show your query, please.
Jan 26 '07 #2
iburyak
1,017 Recognized Expert Top Contributor
See my query:


[PHP]Select *
From (select name, next_run_date, next_run_time,
convert(datetim e, convert(varchar (20), convert(datetim e,convert(varch ar(20),next_run _date)),101) + ' ' +
left(convert(va rchar(20), next_run_time, 108),len(next_r un_time)-4) + ':' + left(right(conv ert(varchar(20) , next_run_time), 4),2)) datetime
from msdb..sysjobsch edules
where next_run_date > 0 and next_run_time > 0 ) a
where datetime between getdate() and dateadd(hh,4,ge tdate())[/PHP]

This query was challenging because date and time stored in different columns as integers.
Jan 26 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

9
1900
by: Simon Harris | last post by:
Hi All, Ok - I'll confess from the start, this is more about application logic that ASP, being an ASP programmer, I guessed you people might be able to help! :) I have built a room bookings system, based on ASP/SQL Server. Bookings are stored in a table, which holds start date+time and End date+time, amougst other info. Bookings can run...
5
11633
by: Tim Whelan via DotNetMonster.com | last post by:
Hi, I?m programming a web app using c# and asp.net and I am trying to display a list of performances that are scheduled in the next month, in a listbox. So I need to get today?s date in my code and compare it to the dates of all the concerts and display the appropriate ones. My main problem is getting today?s date can anyone help. Thanks in...
0
1331
by: Koretex | last post by:
Hi, I am able to run all my DTS jobs manually, but when I try to run the shceduled jobs for those DTS, they all fail. It seems to be a security issue, but no matter who the owner is of job or dts, the jobs fail. This has started today as a complete reinstall of OS and SQL Server was needed after a hacker got in to the server and caused havoc....
1
1660
by: jmottolo | last post by:
Hi, I am using SQL 2005 Standard sp1 on MS Windows Server 2003. My backup maintenance plans execute fine if done manually, but the scheduled jobs fail to run at the scheduled time 10pm. I believe they had been working before. Likewise the maint clearing is not taking place. There is enought disk space currently available.
5
4320
by: Josh | last post by:
I have a website w/ Yahoo Web Hosting and unfortunately they do not allow use of cron jobs. My site sends out automated personalized e- mails on a regularly scheduled basis, currently via the method of placing the e-mail PHP code on a page on the site and accessing it at some point each day. I would like to set it up as fully automated on...
1
2081
by: Pink Panther | last post by:
Hi All, Sorry this may be a repost as first attempt died on me... I have a set of 50 materialized views that are populated every morning. However 2 of the materialized views contain no records (I know the master does contain records). None of the jobs are broken and all run as scheduled.
0
1266
by: Don't Spam Me | last post by:
Hi, I am having a small problem with the Oracle Enterprise Manager. I have successfully used it in the past, and it's worked fine for me, but recently, I wanted to change the backup job that i scheduled there. I deleted the "predefinedBackupStrategy" and submitted a new one. Now, the status of the old job is "Deleting", and the status...
3
6709
by: John | last post by:
Hi. I have a number of batch jobs that are ran nightly on our Windows 2000 based Oracle 8.1.7 (soon to be 9i) server. I have these designed just right, so the Windows Scheduled Tasks runs them and then a parser goes through the output and, in case of errors, sends me a page... The database is our financial system which requires users to...
1
2071
by: traceable1 | last post by:
I created a new database instance, but I forgot to script out the scheduled jobs before I wiped out the original database instance. I have attached the original msdb database as msdb_old onto the new instance, but I need a script to pull out the require information from sysjobs, etc. to recreate the jobs. Please help! Thanks, trace
0
7915
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8204
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8339
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6617
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5712
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1184
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.