Reputation: 7092
I have table which consists column of ntext data type.
I write query that search for some example, like:
SELECT
Id,
NtextColumnName
FROM Table
WHERE
NtextColumnName LIKE N'%search_term%'
and got certain number of rows. but, when viewing this column to find this search_term
I don't see it, it seems that result is truncated.
I also tried to show result in text and apply Find, but no result.
How can I examine existence of some search term in NtextColumnName
column, and also make this result visible?
Upvotes: 0
Views: 5589
Reputation: 8878
Depending on how long your column data is, if you're just looking to view the data in Management Studio, cast the column to an XML data type:
declare @t1 table(c1 ntext)
insert into @t1 values(space(5000) + 'a' + space(5000))
select cast(c1 as xml) from @t1
That example will give you a single column, which you can click on to see the entire set of data in a new window.
The settings for maximum amount of data returned:
Edit: to get the full value, for larger data sizes, this answer points to the correct way to wrap it in a CDATA column:
declare @t1 table(c1 ntext)
insert into @t1 values(space(10000) + 'a' + space(10000))
select
convert(xml,'<xml><![CDATA[' + cast(c1 as varchar(max)) + ']]></xml>')
from
@t1
Upvotes: 2