Hi everybody,
I'm thinking of writing an SP that would attempt to seach mutltiple fields by each word in a phrase. Here is a part I'm not sure how to handle.
Say, I pass "Name1 Name2" and I need to create a query like this
select ... from ... where (field1 like "Name1%" or field2 like "Name1%" etc.) and (field1 like "Name2" or ...)
I can get a list of words into table valued function, but does it mean I would have to create a dynamic SQL? In this case I don't need an SP, I guess.
Since I would probably have just few words (less than 4, I guess) I may try to code with IF statements...
Appreciate your ideas.
Thanks in advance.
If it's not broken, fix it until it is.
My Blog