STAY IN TOUCH

Get New posts delivered straight to your inbox

  • Madeira Team

PrintMax

This script creates the “PrintMax” stored procedure, which prints a text of any size. It’s intended to replace the “Print” statement, which is limited to a text size of up to 4,000 bytes.

The “PrintMax” stored procedure does the following: 1. It accepts a NVARCHAR(MAX) input parameter. So any text value you pass (Unicode or non-Unicode, fixed length or variable length) is converted to NVARCHAR(MAX) .

2. It splits the large text into chunks of up to 4,000 characters.

3. It searches for the last line break within each chunk and splits the string there. This way, it doesn’t just cut sentences in the middle. It uses existing line breaks in the text in order to perform the split. The output is much more readable.

For more information about this stored procedure: www.madeirasql.com/all-you-can-print.


#programming #tsql #storedprocedures

JOIN OUR MAILING LIST

CONTACT US

 3 Rapaport St. Kfar Saba, Israel

 +972-9-7400101

  • Google+ - White Circle
  • Facebook - White Circle
  • Twitter - White Circle
  • LinkedIn - White Circle