• Correct, so my assumption is the code has some control flow logic checks that make the loop exit early if NULL values are detected, but it doesnt make sense to go through the motions, if the end result is going to be NULL.

    I suspect something like this is in place.

    WHILE @i < @LenStr+1 AND DATALENGTH(@Search) > 0 AND DATALENGTH(@ReplaceWith) > 0

    My main point was that even if you were to get past the NULL parameters it would do you no good because NULL cannot concenate with strings to produce a value.