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
 General SQL Server Forums
 New to SQL Server Programming
 calculating number of working days in a month

Author  Topic 

rnatarajan1
Starting Member

4 Posts

Posted - 2007-09-04 : 01:25:51
Hi 2 all,
I need to calculate the number of working days in a month. In clear, i need to ignore saturday.sunday and holiday in a month.

can anyone say the solution?

thanks.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-09-04 : 02:40:46
If you have a holiday table, you can do something like this

select count(*) from f_table_dates('20070901', '20070930')
where weekdayname not in ('sat', 'sun') and date not in (select date from holidaytable)

Or read an article here
http://www.sqlservercentral.com/columnists/plarsson/howmanymoremondaysuntiliretire.asp



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

aldopervanic
Starting Member

1 Post

Posted - 2007-11-24 : 02:48:47
Good solution with IN.

Anybody has experience with IN function used with large amount of data imported from another table?


Aldo Pervaniæ
The best solutions are simple solutions.
Go to Top of Page
   

- Advertisement -