SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Using Datediff to split up vacation time
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

2 Posts

Posted - 07/21/2004 :  11:25:42  Show Profile  Reply with Quote
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!

Flowing Fount of Yak Knowledge

1242 Posts

Posted - 07/21/2004 :  19:29:24  Show Profile  Visit timmy's Homepage  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000