Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / DB Engine / SQL Server / July 2008

Tip: Looking for answers? Try searching our database.

Find employee work hours in time range

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sqlTest - 17 Jul 2008 11:50 GMT
Hello,
I have the table "EmployeesTimeWork" with the structure:

IdEmployee  Date   TimeIn  TimeOut
-------------------------  ---------   ------------------

In other I have the 1 day ranges from the hours like
5-6,6-7,...12-13,..23:0,..to 4-5

I have sumarizing the total hours works by range but I'm not find the
solution.
The most complex situation-case is when the employe work start at
23hour (example) and
to finally at 3:00 (example)

Also I work with sql server 2005

A lot of thanks in advance and sorry for my english
Uri Dimant - 17 Jul 2008 12:22 GMT
sqlTest
A few days ago a SQL Server MVP Steve Kass has posted simple script to get a
difference between two days

In  your case , construct Date+TimeIN and Date +TimeOUT and compare by using
Steve's script

WITH Secs(s) AS (

SELECT DATEDIFF(second, '2008-06-07T21:30:05',
2008-06-08T02:33:15')  ----Add here from your table.....

)

SELECT RIGHT(s/3600,6) + ':'

+ RIGHT(100+s%3600/60,2) + ':'

+ RIGHT(100+s%60,2)

FROM Secs;

> Hello,
> I have the table "EmployeesTimeWork" with the structure:
[quoted text clipped - 14 lines]
>
> A lot of thanks in advance and sorry for my english
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.