This is a discussion on SELECT...LIKE: How to get '100' string whithout getting '45,100' within the SQL Server forums, part of the Microsoft SQL Server category; --> Hello We've got a string field with some words, and I created a form so that anybody could search ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hello We've got a string field with some words, and I created a form so that anybody could search someting into this field. SELECT * FROM customer_table WHERE description LIKE '%query%'"; But if you search '100', it returns '45,100'. Or if you get 'plugged', it reurns 'unplugged'. I tried with: SELECT * FROM customer_table WHERE description LIKE '% query %'"; (note the blanks after and before) But it does not work with a word in the beginning of the field. Does anybody have any experience? Thank you very much. |
| ||||
| On 2003-09-10, Francesco Moi <francescomoi@europe.com> wrote: > We've got a string field with some words, and I created a form > so that anybody could search someting into this field. > > SELECT * FROM customer_table WHERE description LIKE '%query%'"; > > But if you search '100', it returns '45,100'. Or if you get > 'plugged', it reurns 'unplugged'. > > I tried with: > SELECT * FROM customer_table WHERE description LIKE '% query %'"; > (note the blanks after and before) > > But it does not work with a word in the beginning of the field. > > Does anybody have any experience? Thank you very much. You got quite near with your last try. '% query %' finds alle query-Words surrounded by spaces 'query%' finds the word at the beginning '%query' at the end You know "OR"? -- Marco Dieckhoff icq# 22243433 GPG Key 0x1A6C95BA -- http://www.frankonia-brunonia.de/keys |