Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 search nText field......????

Author  Topic 

dnf999
Constraint Violating Yak Guru

253 Posts

Posted - 2007-01-30 : 13:13:01
Hi I have an nText field of over 670,000 in length.

HOw can i search this field with a like statement??

If i cast as varchar(8000), the field will be limited to 8000 therefore my like search will not search the whole field.

I get the following error when running the code:

Select * from table
where ntext_Field like '%word%'

Msg 403, Level 16
INvalid operator for data type. Operator equals add, type equals ntext.


Any help would be great appreciated!!

Thanks

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2007-01-30 : 14:22:00
are you really on 2005? you are posting in the 2005 forum.

if so you can use varchar(max) instead of text. then you can use like, etc.


www.elsasoft.org
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2007-01-30 : 15:13:47
see patindex
where patindex('%word%',ntext_Field) <> 0


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -