MSSQL · the solution of the maximum output length limit

Time:2021-6-12
Reading time |0.11 minutes word count |234.4 characters
primary coverage |1. Introduction & background
MSSQL – solution to the limitation of maximum output length
Author | SCscHero Writing time | 2021/5/16 AM2:25
Article type |Series Completion |Completed
motto Every great cause has a trivial beginning.

1、 Introduction & background    Completion: 100%


a) Coping with problems

When splicing T-SQL strings in stored procedures or views, it is found that the following parts are truncated when printing. How to display all the string contents?

b) Application scenarios

You need to print a long string in SQL server.

c) Solution principle & method

  • The @ SQL variable is a very long nvarchar variable.
SELECT @SQL FOR XML PATH('')
  • After execution, it is found that a link like thing is displayed.
MSSQL · the solution of the maximum output length limit
  • Click in and SSMS will open a new window for the complete string.
MSSQL · the solution of the maximum output length limit

2、 Statement and references    Completion: 100%


Original blog, please do not reprint without permission.

If you have any help, you are welcome to like, collect and pay attention. If you have any questions, please comment! If you need to contact the blogger, you can directly send a private message to scscshero.