top of page


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:




Get New posts delivered straight to your inbox

Thank you for subscribing!

bottom of page