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
Posted Wednesday, March 06, 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: Monday, April 14, 2014 10:55 AM
Points: 532, Visits: 984
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.

Post #1427442
Posted Thursday, March 07, 2013 12:03 AM



Group: General Forum Members
Last Login: Yesterday @ 9:25 AM
Points: 7,070, Visits: 12,523
Here's how I usually handle it:

DECLARE @long_string NVARCHAR(MAX) = N'Hello world!';

SELECT @long_string AS [processing-instruction(long_string)]

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
Post #1427796
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse