I have this query
select top 10 * from FREETEXTTABLE([Venue], FullAddress, 'Canada')
which works fine, and produces results;
now if I’m calling this from code, and provide parameters, it is changed to
exec sp_executesql N'select top 10 * from FREETEXTTABLE([Venue], FullAddress, ''@p'')',N'@p nvarchar(4000)',@p='Canada'
which produces no results whatsoever.
As far as I understand those 2 queries should produce identical output ? Or FREETEXTTABLE is especially picky about parameters ?
In this case, you shouldn’t add the single quotes when using a
NVARCHARparameter. Try the following instead: