It would also be interesting to see what they were doing in the rest of the query for that particular use of a Numbers table.
Actually, I had to rewrite the query, because it relied on undefined behaviour. The purpose was to remove all control characters. It went
SELECT @xmlstr = replace(@xmlstr, char(n), '') FROM numbers WHERE number n BETWEEN 0 AND 31
This XML is coming from another system, and apparently the XML is sometimes garbled.
A second problem is that this will never work for char(0) since that is undefined character unless you cast to a binary collation. A third problem is that the numbers table in questions starts on 1...
I rewrote the operation using transpose. Still using numbers, but I had to compensate for the missing 0.