I'm trying to do a search of all the columns of a specific table and I want to return the result that contains certain characters. For example
Entered Search Value: "Josh"
Output Values: Josh, Joshua, Joshie, Rich Joshua
I want to return all values containing the characters Josh
. I'm trying to use FreeTextTable
however it only returns exact words like this
Entered Search Value: "Josh"
Output Values: Josh
I'm using the following code.
DECLARE @nameSearch NVARCHAR(100) = 'Josh';
SELECT MAX(KEY_TBL.RANK) as RANK, FT_TBL.ID
FROM Property FT_TBL
INNER JOIN (SELECT Rank, [KEY]
from FREETEXTTABLE(Property, *, @nameSearch)) AS KEY_TBL
ON FT_TBL.ID = KEY_TBL.[KEY]
GROUP BY FT_TBL.ID
I know this will be possible by using LIKE
or CONTAINS
but I have a lot of rows in that table and it would take time before it returns the result. So I need to use FreeTextTable
to get the Rank
and Key
. However I can't achieve my goal here. I need help. Thanks!