• I see. So if you want to remove the full set of 37 unprintable characters, you would have to create 37 levels of nesting with REPLACE. I guess the computer scientist in me is concerned about 37 full string scans per value when Jeff's code only does one. However, Jeff also uses the PATINDEX function and double wildcards, so I guess it says something about the performance of PATINDEX if the nested REPLACE functions are still faster.

    Seems like there should be a better way! CLR maybe?

    Maybe a better question is, why is a deeply nested REPLACE so much faster than Jeff's solution?