April 25, 2013 at 10:35 am
There is a table Order in which one filed [Notes] as text data type.
How to search a partial text such as "ordered on 10/02/2012" in the field [Notes]?
April 25, 2013 at 10:43 am
adonetok (4/25/2013)
There is a table Order in which one filed [Notes] as text data type.How to search a partial text such as "ordered on 10/02/2012" in the field [Notes]?
convert to varchar(max), and then you can use a LIKE statement...it will be slow,a nd involve a table scan, but that's the way:
SELECT *
FROM ORDERS
WHERE CONVERT(varchar(max),[Notes])
LIKE '%ordered on 10/02/2012%'
Lowell
April 26, 2013 at 11:38 am
adonetok (4/25/2013)
There is a table Order in which one filed [Notes] as text data type.How to search a partial text such as "ordered on 10/02/2012" in the field [Notes]?
If this field is going to be searched often, I would strongly consider using Full Text Search (FTS) which is usually far better solution than using a non sargeble function and a LIKE with both sides wildcarded in terms of server cost.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy