Ok, I think I fixed it. I forgot one thing from Jeffs function, then I just fiddled with the numbers until it seemed to work.
IF OBJECT_ID('dbo.fnAddWorkdays','fn') IS NOT NULL
DROP FUNCTION dbo.fnAddWorkdays
GO
CREATE FUNCTION dbo.fnAddWorkdays (@Start DATETIME,@NumDays INT)
RETURNS DATETIME
AS
BEGIN
DECLARE @EndDate DATETIME
SELECT @EndDate =
(DATEADD(d,@NumDays,@Start)-1) + -- I forgot the -1 here (DATEDIFF(wk,@Start,DATEADD(d,@NumDays,@Start))*2)
+(CASE WHEN DATENAME(dw,@Start) = 'Sunday' THEN 1 ELSE 0 END)
+(CASE WHEN DATENAME(dw,@Start) = 'Saturday' THEN 3 ELSE 0 END) --changed the 1 to a 3 and it works
RETURN @Enddate
END
Greg
_________________________________________________________________________________________________
The glass is at one half capacity: nothing more, nothing less.