您如何查看 SSMS 中 ntext 或 nvarchar(max) 中的所有文本?

2021-12-02 00:00:00 tsql sql-server-2008 sql-server ssms

如何在 SQL Server Management Studio 中查看来自 NTEXT 或 NVARCHAR(max) 的所有文本?默认情况下,它似乎只返回前几百个字符(255?),但有时我只想快速查看整个字段,而无需编写程序来执行此操作.即使 SSMS 2012 仍然有这个问题:(

解决方案

选项 (查询结果/SQL Server/结果到网格页面)

<块引用><块引用>

要更改当前查询的选项,请单击查询"菜单上的查询选项",或在SQL Server 查询"窗口中右键单击并选择查询选项".

...

<块引用><块引用>

检索的最大字符数
输入 1 到 65535 之间的数字以指定将在每个单元格中显示的最大字符数.

如您所见,最大值为 64k.默认值要小得多.

顺便说一句,结果转文本有更严重的限制:

<块引用><块引用>

每列显示的最大字符数
此值默认为 256.增加此值可显示更大的结果集而不会被截断.最大值为 8,192.

How do you view ALL text from an NTEXT or NVARCHAR(max) in SQL Server Management Studio? By default, it only seems to return the first few hundred characters (255?) but sometimes I just want a quick way of viewing the whole field, without having to write a program to do it. Even SSMS 2012 still has this problem :(

解决方案

Options (Query Results/SQL Server/Results to Grid Page)

To change the options for the current queries, click Query Options on the Query menu, or right-click in the SQL Server Query window and select Query Options.

...

Maximum Characters Retrieved
Enter a number from 1 through 65535 to specify the maximum number of characters that will be displayed in each cell.

Maximum is, as you see, 64k. The default is much smaller.

BTW Results to Text has even more drastic limitation:

Maximum number of characters displayed in each column
This value defaults to 256. Increase this value to display larger result sets without truncation. The maximum value is 8,192.

相关文章