March 6, 2013 at 8:14 am
Has anyone built or seen a custom Print function for SQL? I'm running into the 4000 character limitation and before I go ahead and build one of my own I was wondering if anyone already had one. Basically the problem I'm running into is that my nvarchar(max) is way over 4000 characters and I need to print it in pieces, extracting 4000 character chunks from it each time.
Thoughts?
March 7, 2013 at 12:03 am
Here's how I usually handle it:
DECLARE @long_string NVARCHAR(MAX) = N'Hello world!';
SELECT @long_string AS [processing-instruction(long_string)]
FOR XML PATH(''),
TYPE;
It outputs a clickable XML cell when in the SSMS with Grid Output turned on and when you click on it you see the entire text, untruncated, as an XML fragment:
<?long_string Hello world!?>
edit: quote XML so angle-brackets are not escaped
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply