SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
Search:  
 
 

LongPrint

By Timothy A Wiseman, 2008/07/28

Total article views: 692 | Views in the last 30 days: 4

This very simple procedure is designed to overcome the limitation in the SQL print command that causes it to truncate strings longer than 8000 characters.

It will print the text passed to it in substrings smaller than 8000 characters. If there are carriage returns (CRs) in the text, it will break up the substrings at the carriage returns and the printed version will exactly reflect the string passed.

If there are insufficient CRs in the text, it will print it out in blocks of 8000 characters with an extra carriage return at that point.

If it is passed a null value, it will do virtually nothing.

I developed a need to display very lengthy strings while trying to debug a script that generated a very long dynamic SQL section. When I did not instantly find a script to do this on SQLServerCentral.com I decided it would be faster to write one myself than search the broader internet.

By Timothy A Wiseman, 2008/07/28

Total article views: 692 | Views in the last 30 days: 4
Your response
 
 
Related tags

Print    
String Manipulation    
 
 
Contribute

Free registration required...

To read the rest of this article, and access thousands of other articles, we ask you to register on the site and subscribe to our newsletters.

Login (existing users)

Login

Email:   Password:   Remember me: Forgotten your password?

Register (new users)

Register

Email:   Password:
Confirm:

Subscribing to our newsletters gets you:

  • ALL of our content (thousands of articles, scripts, and forum postings)
  • A daily newsletter (example)
  • A weekly news round up (example)
  • The opportunity to ask and answer questions in our forums
  • A daily Question of the Day to test and help you increase your knowledge of SQL Server.

Steve Jones
Editor, SQLServerCentral.com