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 2000 Forums
 SQL Server Development (2000)
 How to Count Working Hours ?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-06-22 : 07:55:33
sayid writes "In SQL 2000 Query Analyzer I want to count total working hour from different date if between comparing two date that sunday in it so , it will not count :
working Hours from Monday-Friday is 08:00 - 16:00
and Saturday Working hour is 08:16


Ex:
Date1 = 2005/06/17 10:18:06
Date2 = 2005/06/20 10:20:10

If count manually for total working hours for above date is:
1. 2005/06/17 10:18:06 - 2005/06/17 16:00:00 = 05:41:54
2. 2005/06/18 08:00:00 - 2005/06/18 13:00:00 = 04:00:00
3. 2005/06/20 08:00:00 - 2005/06/20 10:20:10 = 02:20:10
Total Working Hour --> 12:02:04

How to count with that condition ?

Thanks


Sayid"

Thrasymachus
Constraint Violating Yak Guru

483 Posts

Posted - 2005-06-22 : 08:13:34
DATEDIFF(hh,@startdatetime,@enddatetime)

Sean Roussy

Please backup all of your databases including master, msdb and model on a regular basis. I am tired of telling people they are screwed. The job you save may be your own.

I am available for consulting work. Just email me though the forum.
Go to Top of Page
   

- Advertisement -