FOR XML PATH 导致 SSMS 被截断为 2034 个字符

2021-10-01 00:00:00 xml sql-server

我使用的是 SQL Server 2008 R2.

I'm using SQL Server 2008 R2.

我正在使用for xml path('')"将字符串连接在一起.

I'm concatenating strings together using "for xml path('')".

我已将工具->选项->SQL Server->结果到网格选项设置为最大值.

I have set the Tools->Options->SQL Server->Results to Grid options to max.

我已将工具->选项->SQL Server->结果文本选项设置为最大.

I have set the Tools->Options->SQL Server->Results to Text options to max.

在网格模式下执行查询并复制一行/一列结果,我看到返回值限制为 2034 个字符.

Executing the query in Grid mode and copying the one row/one colum results, I see the return value is limited to 2034 characters.

在文本模式下执行查询并复制一行/一列结果,我看到返回值限制为 1124 个字符.

Executing the query in Text mode and copying the one row/one colum results, I see the return value is limited to 1124 characters.

如何确保返回值不被截断?

How can I ensure the returned value isn't truncated?

推荐答案

在这里找到答案:

https://stackoverflow.com/a/5658758/609058

出于某种原因,将 XML 转换为字符串会返回一个未截断的字符串.

For some reason, converting the XML to a string returns a non-truncated string.

不知道为什么有效,但确实有效.

Not sure why it works, but it does.

相关文章