Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 Sum Up TimeOut - TimeIn As total workhours

Author  Topic 

gingank
Starting Member

1 Post

Posted - 2012-10-07 : 21:25:19
Could anyone help me on this?
My database design as like this:-
Name(varchar)
TimeIn(Varchar)
TimeOut(Varchar)

Output:
NAME TIMEIN TIMEOUT Totalworkhour
LEE 08:15 18:15 10

How could i calculate it so that it will display total work hours = 10 HOURS ?

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2012-10-08 : 01:09:51
Try this

Select datediff(hh,cast(TimeIn as smalldatetime),cast(TimeOut as smalldatetime))

Senthil Kumar C
------------------------------------------------------
MCITP - Database Administration SQL SERVER 2008
MCTS - Database Development SQL SERVER 2008
Go to Top of Page
   

- Advertisement -