This will do it
DECLARE @StartDate DATETIME
DECLARE @EndDate DATETIME
DECLARE @Cnt INT
DECLARE @Diff INT
DECLARE @OutCnt INT
SET @StartDate = '2/1/2002' --Starting point
SET @EndDate = '3/1/2002' --Ending Point but does not count this day change WHILE @Cnt <= @Diff to count day
SET @Cnt = 0 --Set TO 0 so NULL has no effect on it.
SET @OutCnt = 0 --Set TO 0 so NULL has no effect on it.
SET @Diff = DATEDIFF(d,@StartDate, @EndDate) --Calc number of days
PRINT @Diff
WHILE @Cnt < @Diff --As long as we haven't gone that many days.
BEGIN
IF DATEPART(dw,DATEADD(d,@Cnt, @StartDate)) IN (2,3,4,5,6)
SET @OutCnt = @OutCnt + 1
SET @Cnt = @Cnt + 1 --Add one day TO incrementing value
END
PRINT @OutCnt --Output COUNT OF buiness days.
"Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)