Sql server agent doesn't run as scheduled(Recurring) - sql

I have a SQL job set up to run once every 12 hours everyday -at 7AM and 7PM. The job only runs at 7PM everyday but not the next day morning.
Can you help me and point out the problem please? Thanks!
Schedule Type :Recurring. Enabled.
Frequency-
occurs: Daily
Recurs: 1 Day
Daily Frequency -
Occurs every:12 hours
Starting at 19:00:00
Ending at 20:59:59
Duration-
Start Date :15/11/2013
No End Date
This is what the summary at the end says :
Occurs every day every 12 hour(s) between 19:00:00 and 20:59:59. Schedule will be used starting on 2013-11-15.

Related

How Schedule a Azure Data Factory Trigger for 30 minute intervals per day

I how like a create a Azure Data Factory Triggger to run every day at 30min intervals. However, I don't seem to be able to create 30mins interval per day. The nearest I appear to get is 1 hour.
E.g, I would like 6:30, 7:00, 7:30, 8:00 etc.
But as you can see I appear to only schedule hourly per day
Why not this , its more simpler , its you want to start at :00 or:30 min mark .
Then set the start time as accordingly
I figure it out.
I simply adjusted the execution times to include start minutes of 0, with interval of 30

Schedule a task to run two times a day between two date

I use SQL Server 2017. I need to schedule a job to run at 12am and 12pm for each days between 7th and 27th of each months. In the other word, i need to run my job two times per day between two date in each month.
Can i do that in one schedule task or I have to create a two jobs for each exact day?
12 am 7th month
12 pm 7th month
and so on and so on.
If i have to create a job for each hover of each day i will have several schedule.
Update 1: I did it by creating several steps in schedule tab but i am looking to do that in less steps.
Update 2:
If i can create two steps like below it will good for me.
1 : Occurs every month between 7th and 27th at 12 am
2 : Occurs every month between 7th and 27th at 12 pm
One way to do that is to check if the date is in between 7th and 27th using DATENAME or DATEPART.
--IF (DATENAME(DAY, GETDATE()) >= 7 AND DATENAME(DAY, GETDATE()) <= 27)
IF DATEPART(DD, GETDATE()) BETWEEN 7 AND 27
BEGIN
EXEC [Your Stored Procedure]
END
And then set the Daily frequency to start at 12:00 AM and Occurs every 12 hours.

Find last 10 business days of the current month for schedule

I have a couple of scenarios
Scheduler should compare the current day is with in the last 10 business days of the current month then it should schedule to run current day with 11AM CST.
(E-g) current day : 18th July 2017 (with in last 10 business days) should run and reschedule at 19th July 2017 11.AM CST
IF Last business day(30th or 31st) after runs the scheduler should reschedule it to next month.
(E-g )current day : 31th July 2017 (with in last 10 business days) should run and reschedule at 18th Aug2017 11.AM CST
Can any one help to derive the logic in oracle 11g scheduler?
Thanks in Advance.

Subtracting two dates (including hours and minutes) considering only working time vba or Excel

I need to subtract two dates (including hours and minutes), but I only need to consider working hours. That is, I need to omit lunch time (from 13 to 14 hrs), weekends and hours after 18 hrs and before 9 hrs of the following day, in a working day (from Mo to Fr). Any thoughts?
I don't mind if it's an Excel formula or a vba code.
I have this formula, but it doesn't omit lunch time:
9*(NETWORKDAYS(initial_time;ending_time)-1)-24*((MOD(initial_time;1)-MOD(ending_‌​time;1)))
Here's a possible solution. It assumes an 8 hour work days for all but the start and end date. Also that start date/time is 9:00 or after and end date/time is 18:00 or earlier and that both are on a weekday.
=(NETWORKDAYS(A2,B2)-2)*8+IF(MOD(A2,1)>0.58333,(TIME(18,0,0)-MOD(A2,1))*24,(TIME(18,0,0)-MOD(A2,1))*24-1)+IF(MOD(B2,1)>0.58333,(MOD(B2,1)-TIME(9,0,0))*24-1,(MOD(B2,1)-TIME(9,0,0))*24)
.58333 equates to 14:00. The formula:
multiplies networkdays * 8
+ hours from start date/time until 18:00 subtracting 1 hour if start time is before 14:00
+ hours from 9:00 until end date/time subtracting 1 hour if end time is after 14:00
Of course this doesn't take any holidays into account.

How to add working hours depending on weekday in sql

I want to create a basic case logging system and when somebody opens a new issue, the issue is assigned a Sr_number with a given number of hours. For example Sr_number 1 is 4 hours, 2 is 6 hours, 3 is 8 hours and 4 is 24 hours.
Now adding hours onto a time stamp is easy but the catch is I need to take into account working hours which are 09:00 to 17:00 Monday to Friday.So if a case is given a 12 hour Sr_number and the deadline for this falls at 16:00 on a week day then the deadline is extended to the next working day. Basically the deadline is 12 working hours.And calculation should be 1 hour worked for the issue logged on same day and remaining 11 hours to next working day.
If in case it is sun, it should consider directly go to monday.
Example:
Case created on: 10/06/2015 12:04:39 PM- with Sr_number 1 (12 Hours) Deadline is now: 10/07/2015 12.05 PM
Make sense?
Another catch is I need to take into account hours On Hold and these two have to be only within working hours.
For some case,saturdays is working ,for some its holiday.
How should i proceed.
I tried performing datepart,dateadd and datediff functions.But i could find only weekday.
I am new at sql.Please guide for the same