简体   繁体   English

SQL Server 2005 选择查询未从列中检索完整文本

[英]SQL Server 2005 select query not retrieving complete text from a column

Maybe this would be very simple, but I have no idea why this is happening.也许这会很简单,但我不知道为什么会这样。

To put in simple way, I have inserted a row into a database table which contains a ntext column called content .简单来说,我在包含一个名为contentntext列的数据库表中插入了一行。 String value which got in to this column content has a text length of 6889 characters.进入此列content字符串值的文本长度为 6889 个字符。 However when I do a basic select query based on id, it do retrieve the row - but not the complete text from the column Content .但是,当我根据 id 执行基本的选择查询时,它会检索行 - 但不是来自列Content的完整文本。 All I see in SQL Server Management Studio for this column when I do a select query is the text with characters 43679.当我执行选择查询时,我在此列的 SQL Server Management Studio 中看到的只是包含字符 43679 的文本。

There is no issue with data being inserted and I could see all the text being displayed in front end application.插入数据没有问题,我可以看到前端应用程序中显示的所有文本。 The issue is only when I do a select query, and copy the text to notepad, I do see fewer characters.问题仅在于当我执行选择查询并将文本复制到记事本时,我确实看到较少的字符。 Anything with respect to SQL Server settings/paging/statistics?有关 SQL Server 设置/分页/统计的任何信息? Appreciate if anyone could help me out with this.感谢有人能帮我解决这个问题。

thanks, KK谢谢,KK

SSMS returns a maximum number of characters to the grid or text window of every text based column: SSMS menu: options: Query results node : SQL node : Results to grid / Results to text SSMS 将最大字符数返回到每个基于文本的列的网格或文本窗口:SSMS 菜单:选项:查询结果节点:SQL 节点:结果到网格/结果到文本

I'm sure there is a good reason for this: probably SSMS would fall over even more regularly than it does now.我确信这有一个很好的理由:SSMS 可能会比现在更频繁地崩溃。

Hope this helps... no such thing as a silly question希望这会有所帮助......没有愚蠢的问题

I encountered similar problem , and I found that SSMS is unable to fully retrieve column that is longer than 43680 (in output to Grid mode).我遇到了类似的问题,我发现 SSMS 无法完全检索长度超过 43680 的列(在输出到网格模式下)。

So the work around is output it as XML (unlimited length):因此,解决方法是将其输出为 XML(无限长度):

SELECT convert(xml,'<xml><![CDATA[' + cast([your column] as varchar(max)) + ']]></xml>') 

Then do a quick search and replace ( &lt; to < , &gt; to > ) .然后快速搜索并替换 ( &lt; to < , &gt; to > ) 。 You can now copy the result to Notepad++ to view all the content.您现在可以将结果复制到 Notepad++ 以查看所有内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM