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.
| Author |
Topic |
|
Bhanu_2007
Starting Member
10 Posts |
Posted - 2007-11-06 : 03:07:50
|
Hi frnds, How to find the no. of working days for any month?Input : YearMonth - 200702Output : 20Thanks in Advance  |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-11-06 : 03:11:43
|
Make use of the F_TABLE_DATE function found here at SQLTeam.SELECT COUNT(*) FROM F_TABLE_DATE('20070101', '20071231')where [year] = 2007and [month] = 2and weekday_name not in ('sat', 'sun')How do you compensate for holidays? E 12°55'05.25"N 56°04'39.16" |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-11-06 : 03:13:51
|
| What is the calculation?Do you want to exclude saturdays and sundays?You need date table and do querySelect count(*) from datetablewhere date between '20070201' and '20070228'and datename(weekday,date) not in ('saturday','sunday')MadhivananFailing to plan is Planning to fail |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-11-06 : 03:14:49
|
MadhivananFailing to plan is Planning to fail |
 |
|
|
Bhanu_2007
Starting Member
10 Posts |
Posted - 2007-11-06 : 04:17:39
|
| Yes, i want to exclude the Saturdays & Sundays |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-11-06 : 04:21:31
|
I posted a working solution for you for 66 minutes ago. E 12°55'05.25"N 56°04'39.16" |
 |
|
|
Bhanu_2007
Starting Member
10 Posts |
Posted - 2007-11-06 : 07:29:18
|
Thanks Peso |
 |
|
|
|
|
|