We help IT Professionals succeed at work.
Get Started

Create a SQL function to calculate "datediff" based on hours of operation

socan
socan asked
on
988 Views
Last Modified: 2012-05-05
We have a helpdesk ticketing software database on a SQL 2000 server. We are trying to query to see if an SLA has passed based on the priority of the ticket, but we want this calculation based on 7am - 7 pm Mon - Fri. We were thinking we would have to create a function for this, but don't know how to go about it. Any ideas?

example: a call is logged on wednesday at 6pm and is resolved on thursday at 8:00am the difference shoudl be 2 hours, not 14. If the priority was a 2 (4 hour SLA) then the SLA would be met.

example 2: a call was logged on friday at 2pm and resolved on monday at 10am. Priority 3 is one business day, so it should be met.
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 4 Answers and 9 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE