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 2005 Forums
 Transact-SQL (2005)
 Calculate business days excluding holidays

Author  Topic 

rwaldron
Posting Yak Master

131 Posts

Posted - 2009-11-10 : 04:48:36
Hi all,
This is a very common question asked with so many different answers.
I want to count the number of business days between 2 dates.
I need to exclude weekends and holidays.
The best approach for me would be to use a holiday table.
I can then control which days our company regards as a day off.
Alot of other approaches create a table for you but the holidays never match my situation.
In this holiday table I have 10 dates for 2009 then 10 dates for 2010 etc.These dates are the holidays I want excluded.
My question is how do I now use this table to exclude these dates in the calculation.
ie: for each date that exists in calendar table for that year then -1 from workday count ?
Ray..

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-11-10 : 09:05:01
yes best approach is to have your own calendar table with holiday indicator. That will all things easy


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -