Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting number of working hours
Message
From
16/04/2015 15:26:36
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Getting number of working hours
Environment versions
SQL Server:
SQL Server 2012
Application:
Web
Miscellaneous
Thread ID:
01618554
Message ID:
01618554
Views:
59
I have a table which contains 291000 records. This represents the non working hours. That includes holidays, weekends and overnight hours. Those timeframes should not be considered for a specific calculation I need to perform.

The non working hours table contains a start time and an end time.

So, basically, if I have two transactional dates in a table such as 01/10/2014 08:00:00 and 15/10/2014 17:53:24, I need to use this time table to calculate how many working hours applied between these two dates.

This is done by querying the time table and summarizing differentials.

So far, I have converted a logic from an old code. But, that is very deprecated. There has to be something better, such as a single SQL select that would be capable of returning the duration in hours and/or days.

Anyone has ever done something like that or would be able to provide a SQL select example of how you would see it?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Next
Reply
Map
View

Click here to load this message in the networking platform