I can't quite figure out why I am getting unexpected results from the following query/statement. I have included code to replicate the issue (which may not be an issue at all but more a misunderstanding on my part about how contains
works).
create table dbo.temp (id int identity, description nvarchar(max)) insert dbo.temp values ('this is a website.') --this record will be returned in the select query insert dbo.temp values ('a website exists.') --this record will be returned in the select insert dbo.temp values ('go to mywebsite.net') --this record will NOT be returned in the select insert dbo.temp values ('go to mywebsite.net.') --this record will NOT be returned in the select create fulltext catalog temp create unique index idx_dbo_temp_1 on dbo.temp (id) create fulltext index on dbo.temp(description) key index idx_dbo_temp_1 on temp with change_tracking auto declare @search_client nvarchar(100) = 'website' select * from dbo.temp where contains ((description),@search_client) drop fulltext index on dbo.temp drop index idx_dbo_temp_1 on dbo.temp drop fulltext catalog temp drop table dbo.temp
The query will return records that have website
in the description field but will not return the record which has mywebsite.net
in the description field.
Any thoughts?
UPDATE: the @search_client
variable will really be a parameter passed in via SSRS so declared the variable to simulate the parameter being passed in.