sql like excluding

Hi Experts.
I use the following like statement lower(tekst) like '%est%' that gives me also some results I would like to exclude:
- EST D/A Alexandria V 22
- D/A Brest v 86 oppgj

How can I best approach this?

Best regards,
MB
mark_norgeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Patrick MatthewsCommented:
WHERE lower(tekst) like '%est%' AND tekst <> 'EST D/A Alexandria V 22' AND tekst <> 'D/A Brest v 86 oppgj'
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Alfred A.Commented:
Hi,

Try using binary collation.  Try the following:

WHERE tekst like '%est%' COLLATE Latin1_General_BIN


I hope it helps.
0
Alfred A.Commented:
Hi,

By the way, if you are really just after excluding the two results, then "matthewspatrick" answer is sufficient.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

mark_norgeAuthor Commented:
Hi Alfred1, I was just writing the following comment.

Hi matthewspatrick,

The example given might have been somewhat to simple in a way that I would like to exclude everything that has the word "Brest" in it, I would like to only get the abbreviation EST.
0
Alfred A.Commented:
Hi,

Can I just confirm, you are just after EST or est?

You could do it this way if est only and not EST:

WHERE tekst like '% est %' COLLATE Latin1_General_BIN

or,

You could do it this way if EST only

WHERE tekst like '% EST %' COLLATE Latin1_General_BIN
0
TyugCommented:
Use another like statement for your examples. If there are any other commonalities, try to include those as well to not get unexpected results.

small modification to matthewspatrick's ...

WHERE lower(tekst) like '%est%' AND tekst NOT LIKE '%EST%' AND tekst NOT LIKE '%Brest%'
0
Alfred A.Commented:
Hi,

Aha.  Ok.  you want Br of Brest out of the picture.  You could do it this way.

WHERE tekst like '% EST %' COLLATE Latin1_General_BIN
AND tekst not like 'Br%' COLLATE Latin1_General_BIN

0
mark_norgeAuthor Commented:
Sorry for the late reply, thanks for the help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.