Sometime back I was answering questions on TechNet Forum when I saw an interesting and genuine problem.
The user wanted to calculate the number of leaves taken by an employee excluding weekends. Now calculating the number of leaves wasn’t a big deal all we need to do is just use datediff function but excluding the weekends was something which forced me to think harder.
Then I started digging into this and finally I was able to make logic.
Here is the script: (Updated)
Direct Link: (Updated)
It works pretty well
For the sake of simplicity I’m creating the table with just three columns:
Here is the output:
Do let me know your way to tackle this problem – by way of leaving a comment.