• David Harder (9/3/2015)

    The question is valid. The BOL reference is valid. The comment about understanding how a function works is valid. But the reason the result of the query is NULL is because @TrueValue is NULL so the function can't STUFF an unknown that has no known starting position with a value. This question doesn't really exhibit the behavior of returning a null string as explained in the BOL explanation of the "start" argument.

    It looks to me like it's not null before the STUFF function. It was set to a zero-length string on the prior line. The STUFF function is referencing a starting position of 1. Since that's larger than the length of the string, it returns a null value.

    So in the BOL article: "null string" = "null value" and what I was thinking of as a "null string" ('') is actually a "zero-length string?"