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
 General SQL Server Forums
 New to SQL Server Programming
 Multi word search

Author  Topic 

issammansour
Yak Posting Veteran

51 Posts

Posted - 2007-10-01 : 14:22:14
Hi,

I am trying to search a multi words with “like” function using the following statement in a S.P.:
@ITEM_desc nvarchar(10),
@QUOTFIL nvarchar (200),
@mfil nvarchar (500) = ''

SET @mfil = QUOTENAME('%' + @ITEM_desc + '%','''')
exec ('select * from ims.item where adesc like' + @mfil + @QUOTFIL)
Nrormaly one word can be send to SP for searching, is there any way to send multi word for the like function to search Like follows:

'%LOCAL%,%LIGHTS%'

Best regards

Kristen
Test

22859 Posts

Posted - 2007-10-01 : 14:26:34
You can SPLIT the delimited list, in the Sproc, and OR (or AND if that's what you need) the results.

See: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55210&SearchTerms=CSV,Splitting%20delimited%20lists,Best%20split%20functions

Or you can use the Free Word Search.

Or you could split all the individual; words in your [adesc] column, store them in a "Keywords" table, and JOIN that with the Word List, and the ims.item table.

Kristen
Go to Top of Page

issammansour
Yak Posting Veteran

51 Posts

Posted - 2007-10-01 : 14:38:33
how the Free Word Search works
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2007-10-01 : 14:42:40
this may help you:

http://weblogs.sqlteam.com/jeffs/archive/2004/11/02/2460.aspx

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page
   

- Advertisement -