I posted this before and it didn't appear so I'm posting it again.
Essentially I have a search engine written in ASP that I want to convert
some of the functionality over to a stored procedure. I know you can pass
on a single parameter, for instance, to a stored proc such that you can
have something like this:
Create Procedure search
@searchWord
AS
Select * from inventory where (description like '%@searchWord%')
Order by stock_number
This works fine for single words passed on as a parameter, however, I
wrote the search engine to generate searchs for multiple search words, for
instance, if someone types in "engine Honda 1986" my search engine will
convert that to:
Select * from inventory where (description like '%engine%') and
(description like '%Honda%') and (description like '%1986%') order by
stockNumber
Is there a way I can pass along multiple search words like this to a
stored procedure? I've tried passing along a phrase like
engine%') and (description like '%Honda%') and (description like '%1986%')
as the parameter @searchWord and I thought it would work out to the
desired search phrase once it's used in the stored procedure but that does
not work. Problem is that there can be any number of words that I have to
convert into a search string and pass onto the sql stored procedure.
Thanks,
Ben