• paulo.margarido (8/25/2016)


    ok, now can we go back to the discussion?

    Here is what solves your problem.

    SELECT h.Date

    FROM dbo.Holidays h

    WHERE Territory = @Territory

    AND Level = @Level

    AND Date >= DATEADD(YY, DATEDIFF(YY, 0, @ReuestedDate-2), 0)

    AND Date < DATEADD(YY, DATEDIFF(YY, 0, @ReuestedDate+2), 0)

    If you after some functions, not the actual solution - feel free to create as many functions as you wish.

    _____________
    Code for TallyGenerator