Bert Wagner shows us a few techniques for printing long strings in SSMS:
Erik Darling posts one solution to this problem in his T-SQL Tuesday #104 entry (as well as some other problems/solutions for lengthy SQL variables). Specifically he links to a SQL string printing script that will loop through the lengthy variable and print everything while maintaining formatting:
And while I like using that stored procedure on my primary server, I’m too lazy to install it every where I need it.
Instead, I have a couple of go-to solutions that work on all SQL Server instances 2008 forward.
The approach Bert outlines isn’t perfect, but it is definitely interesting and easier to write than the ones which work a bit better.