I have spent the entire day looking for an answer to this and have resolved myself to the fact that it's not possible after 3 different search engine variations. Here's my problem. I need to search a table of printer model numbers. Because printer models aren't standardized, different parts of the model could be in different orders.
HP OfficeJet Pro 8715
HP OfficeJet 8715 Pro
Both are the same printer obviously but they show up in both ways in the shared DB between us and vendors. The catch is that if I search HP OfficeJet Pro 8715, it should return HP OfficeJet 8715 Pro as well but it should not return HP OfficeJet Pro 8715dw for example.
In summary, the words can be in any order, but the words must match exactly.
I've already parsed the search string into a #temp
table so that each row has a word and this is how I've been comparing to find results.
INSERT INTO #results
SELECT Make, Model
FROM tDevices
WHERE ( Make LIKE '%' + @MAKE + '%' ) AND ( Model LIKE '%' + @MODEL + '%' ) AND ( Model LIKE '%' + @MODEL2 + '%' )
Where each model variable is another word in the model. This works great but returns HP OfficeJet Pro 8715 as well as HP OfficeJet Pro 8715dw
Is this possible?
Thanks