Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 search multiple keywords

Author  Topic 

magmo
Aged Yak Warrior

558 Posts

Posted - 2008-11-10 : 02:44:52
Is there a way to search though a column that holds a number of search criterias, lets say that I have entered this information in a column...

Product 1 - search field column
New volvo Car volvo green turbo

Product 2 - search field column
New volvo Car volvo black turbo

I then want to search like this..

Black car

If I make that search I want to retrieve one hit, and that should be "product 2" since that have both "Black" and "car" as search criteria.

Can this be done?

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-11-10 : 02:57:00
WHERE col LIKE '%black%car%' or col LIKE '%car%black%'

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

lionofdezert
Aged Yak Warrior

885 Posts

Posted - 2008-11-10 : 02:57:14

SELECT * FROM youtable WHERE product LIKE '%Black%Car%'
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-11-10 : 02:58:56
quote:
Originally posted by lionofdezert


SELECT * FROM youtable WHERE product LIKE '%Black%Car%'


It should be in any order
See my first reply

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

magmo
Aged Yak Warrior

558 Posts

Posted - 2008-11-10 : 03:36:42
worked great, Thanks!
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-11-10 : 03:47:20
Or use FULLTEXT?



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

lionofdezert
Aged Yak Warrior

885 Posts

Posted - 2008-11-10 : 05:03:03
YOU R RIGHT MADHI...
Go to Top of Page
   

- Advertisement -