SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Get Business Time


Get Business Time

Author
Message
megan.beebe
megan.beebe
Forum Newbie
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: General Forum Members
Points: 4 Visits: 13
Comments posted to this topic are about the item Get Business Time
jcrawf02
jcrawf02
SSCrazy
SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)

Group: General Forum Members
Points: 2226 Visits: 19324
Just curious, since I used something similar to your previous business day example in-house for a call center: When calculating your business time, how are you handling down-time? (or are you worrying about it?)

For instance, the phone line goes dead for two hours because somebody drove into the pole outside the building. My call center management wants to be able to block situations like this out of the calculation, so on one of 115 days, they only worked 6 hours, every other day they worked 8.

Or last friday, when the air conditioning had issues, and they let everyone go home at lunch, so 4 hours total.

My solution was to let them manage the downtime by creating a reference table with the dates and hours, and if the date was found in their list, pull the appropriate time and subtract from the daily total.

Anyone have a better way? I suppose a smarter approach would be to somehow access the telecom server and calculate the open hours in the call queue.

---------------------------------------------------------
How best to post your question
How to post performance problems
Tally Table:What it is and how it replaces a loop

"stewsterl 80804 (10/16/2009)I guess when you stop and try to understand the solution provided you not only learn, but save yourself some headaches when you need to make any slight changes."
Mohammad Mazharuddin Ehsan
Mohammad Mazharuddin Ehsan
Mr or Mrs. 500
Mr or Mrs. 500 (535 reputation)Mr or Mrs. 500 (535 reputation)Mr or Mrs. 500 (535 reputation)Mr or Mrs. 500 (535 reputation)Mr or Mrs. 500 (535 reputation)Mr or Mrs. 500 (535 reputation)Mr or Mrs. 500 (535 reputation)Mr or Mrs. 500 (535 reputation)

Group: General Forum Members
Points: 535 Visits: 2445
Hi Megan,
I just came across your work while browsing the site. Got curious and checked it randomly. Could you please explain the below results it is giving. How may working hours per day are you assuming and what is working schecdule (Start and End timings of work each working day)

select [dbo].[fn_GetBusinessTimeElapsed] ('2009-04-24 07:18', '2009-04-28 20:18', 'HOURS')


21

select [dbo].[fn_GetBusinessTimeElapsed] ('2009-04-23 07:18', '2009-04-28 20:18', 'HOURS')


29

Sincerely,
Maz

-----------------------------------------------------------
Time Is Money
Calculating the Number of Business Hours Passed since a Point of Time
Calculating the Number of Business Hours Passed Between Two Points of Time

Mohammad Mazharuddin Ehsan
Mohammad Mazharuddin Ehsan
Mr or Mrs. 500
Mr or Mrs. 500 (535 reputation)Mr or Mrs. 500 (535 reputation)Mr or Mrs. 500 (535 reputation)Mr or Mrs. 500 (535 reputation)Mr or Mrs. 500 (535 reputation)Mr or Mrs. 500 (535 reputation)Mr or Mrs. 500 (535 reputation)Mr or Mrs. 500 (535 reputation)

Group: General Forum Members
Points: 535 Visits: 2445
Hi jcrawf02,

You have a very valuable suggestion to modify the solution. The solution should sum the duration from your downtime table between the two points of time and subtract it from the total time. Check my solutions. It counts for the lunch break timings also.

Sincerely,
Maz

-----------------------------------------------------------
Time Is Money
Calculating the Number of Business Hours Passed since a Point of Time
Calculating the Number of Business Hours Passed Between Two Points of Time

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search