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
 Transact-SQL (2000)
 Using Datediff to split up vacation time

Author  Topic 

Skierm2
Starting Member

2 Posts

Posted - 2004-07-21 : 11:25:42
I am having some trouble figuring out how to find the differnce between two dates and not include the weekends and holidays. The problem is, if I have vacation time that falls over two months (eg: July 29th - August 3th) That is technically only 21 hours of vacation time (7 hour days), I need to be able to show 14 hours for July and 7 hours for August, but how do I figure out(out 21 vacation hours) how many hours fell in July and how many fell in August. If I used a datediff I am going to get 5.

Any help would be greatly appreciated. Thanks in advance!

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2004-07-21 : 19:29:24
You'll probably need to create a UDF for this. Otherwise your query will be close to unmanagable. Particularly if you want to include holidays - in which case you'll obviously need to create a separate table.






Go to Top of Page
   

- Advertisement -