473,394 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Find all jobs scheduled between two dates

1
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 6646
iburyak
1,017 Expert 512MB
Show your query, please.
Jan 26 '07 #2
iburyak
1,017 Expert 512MB
See my query:


[PHP]Select *
From (select name, next_run_date, next_run_time,
convert(datetime, convert(varchar(20), convert(datetime,convert(varchar(20),next_run_date )),101) + ' ' +
left(convert(varchar(20), next_run_time, 108),len(next_run_time)-4) + ':' + left(right(convert(varchar(20), next_run_time),4),2)) datetime
from msdb..sysjobschedules
where next_run_date > 0 and next_run_time > 0 ) a
where datetime between getdate() and dateadd(hh,4,getdate())[/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
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...
5
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...
0
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,...
1
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...
5
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...
1
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...
0
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...
3
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...
1
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.