Reputation: 6029
I have a really long filename stored in the database (the file name) with the full path: C:\folder\folder\my_supper_file_name_right_here.docx
If I use traditional
SELECT * FROM MYTABLE WHERE Name LIKE '%file%'
I will get all the results where the file name has in the name the word file
If I use
SELECT * FROM MYTABLE WHERE CONTAINS(Name, 'file')
I get nothing
The catalog is created, the index as well and is populated.
Is my CONTAINS query wrong?
Upvotes: 0
Views: 632
Reputation: 1
Using this way will solve your problem.
DECLARE @STR AS VARCHAR(100)
SET @STR = '"'+@STR +'*"'
SELECT * FROM MYTABLE WHERE (CONTAINS(Name, @STR))
Upvotes: 0