|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Today @ 10:46 AM
Points: 421,
Visits: 777
|
|
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?
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 9:55 PM
Points: 6,720,
Visits: 11,759
|
|
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
Believe you can and you're halfway there. --Theodore Roosevelt
Everything Should Be Made as Simple as Possible, But Not Simpler --Albert Einstein
The significant problems we face cannot be solved at the same level of thinking we were at when we created them. --Albert Einstein
1 apple is not exactly 1/8 of 8 apples. Because there are no absolutely identical apples. --Giordy
|
|
|
|