This Blog will help you to find out the
working days between two dates.
Here @startdate indicate the first date and @enddate indicate
the last date, by these two date we can calculate the working days for a
company/organization. In this code we use two case, first case is used for
Saturday and other case is used for Sunday Where we use Saturday and
Sunday As non working days. It will help you to exclude these two day's from the working days.
The Code is shown Below
DECLARE @enddate DATETIME
SET @enddate = '2013/04/30'
(DATEDIFF(dd, @startdate, @enddate) + 1)
@enddate) * 2)
-(CASE WHEN DATENAME(dw, @startdate) = 'Sunday' THEN 1 ELSE 0 END)
-(CASE WHEN DATENAME(dw, @enddate) = 'Saturday' THEN 1 ELSE 0 END) as