Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Custom print? Expand / Collapse
Author
Message
Posted Wednesday, March 6, 2013 8:14 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Wednesday, September 10, 2014 2:29 PM
Points: 541, Visits: 1,050
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?
Post #1427442
Posted Thursday, March 7, 2013 12:03 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 7:19 PM
Points: 7,127, Visits: 12,655
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
Post #1427796
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse