首页 > 解决方案 > 我在 2019 SSMS 中没有得到完整的结果,它被截断了,我想显示 2729 个字符

问题描述

FORMATEMESSAGE在 SSMS 2019 中显示,它以省略号“...”结尾。

我试过PRINT(@var)了,它显示了完整的消息,但是只有在 1000 个字符之后才以CONCATorFORMATEMESSAGE结尾。'...'我的全长是 2729。我知道FORMATEMESSAGE它只包含 2047 个字符,但是如果我需要结果,还有什么替代方法'EXEC this and that'

标签: sql-servertsqlssms

解决方案


From FORMATMESSAGE (Transact-SQL):

msg_string
Applies to: SQL Server ( SQL Server 2016 (13.x) through current version).

Is a string enclosed in single quotes and containing parameter value placeholders. The error message can have a maximum of 2,047 characters. If the message contains 2,048 or more characters, only the first 2,044 are displayed and an ellipsis is added to indicate that the message has been truncated. Note that substitution parameters consume more characters than the output shows because of internal storage behavior. For information about the structure of a message string and the use of parameters in the string, see the description of the msg_str argument in RAISERROR (Transact-SQL).

2729 characters is too long for FORMATMESSAGE.


推荐阅读