Unix Technical Forum

SELECT...LIKE: How to get '100' string whithout getting '45,100'

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 ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 06:50 PM
Francesco Moi
 
Posts: n/a
Default SELECT...LIKE: How to get '100' string whithout getting '45,100'

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 06:50 PM
Marco Dieckhoff
 
Posts: n/a
Default Re: SELECT...LIKE: How to get '100' string whithout getting '45,100'

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:08 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com