Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 419
  • Last Modified:

SQL Contains Sentence problem

when using this where sentence:

where contains (TYPE, '"HEP C"')

I get in my results HEP C  and HEP B.  how can I rewrite this contains sentence to only get fields with HEP C . this problem only appears when I use a single character at the end.
0
lespbaj
Asked:
lespbaj
1 Solution
 
celazkonCommented:
i would use:
WHERE columnname LIKE '%HEP C%'
0
 
tigin44Commented:
SELECT ....
FROM ....
WHERE type LIKE '%HEP C%'
0
 
Gary DavisDir Internet SvcsCommented:
Using Contains is for Full Text searching. Make sure your individual C and B characters are indexed as if they are words (and any other individual character-words) and are not in the stop list.

See http://forums.asp.net/t/1435421.aspx/1, for example.

You could use full-text search to get a list of all matching rows for the word "hep" and from that, do a Like search for "%Hep c%" which would be faster than just using Like on the whole table (depending on its size).

Gary Davis
Webguild.com
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now