This short script will show how to loop through a string in T-SQL and display the ASCII characters.
Why would you need to do this? Sometime you need to see (visibly) the placement of non printable characters in a string, like CR (ASCII 13), LF (ASCII 10) or TAB (ASCII(9). This script does that. The output will look take text that look like this:
And show this: