I'm trying to run a strored procedure that selects rows (from a fulltext indexed column - sql-azure v12) where words contain a small part of a search word. For instance if a user types "natio" in the search string I want to return all the rows that contain "international". I red that I should use the prefix * before and after the search string but that doesn't work. Here is what I've tried so far.
SET @searchString = '*' + @searchString +'*'
or SET @searchString = @searchString +'*'
or SET @searchString = '*' + @searchString
SELECT * FROM myTable where FREETEXT(sWords, @searchString )
or
SELECT * FROM myTable where CONTAINS(sWords, @searchString )
None of the above combinations seem to work. It would only works if I typed the whole word (international in this case). Any help would be well appreciated.
EDIT
I got half an answer from the question link listed above:
SELECT *
FROM product
WHERE CONTAINS(name,'"*1340*"');
I used the same logic for my variable which became:
SET @searchString ='"*' + @searchString + '*"';
It solved half of what I want to accomplish. Now if I entered "inter" in the search string I would get all words that start with inter such as international. However if I entered "national", then I won't get "international".
I think I still need to dig deeper to find a complete solution...