Full Text Search

Last Post 21 Jan 2011 11:21 AM by dbandee. 5 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
dbandee
New Member
New Member

--
18 Jan 2011 01:19 PM
my FT search dilemma

declare @CEOName nvarchar(4000)
set @CEOName = 'John Smith,Jen Smith'
set @CEOName = '''"' + REPLACE(@CEOName, ',', '*" OR "') + '*"'''

--select @CEOName

--when i use variable it does not work
select * from test.dbo.CEOList
where contains (CEOName, @CEOName)

--when i put same value from the variable it works
select * from test.dbo.CEOList
where contains (CEOName, '"John Smith*" OR "Jen Smith*"')

did anyone had similar issue?

gunneyk
New Member
New Member

--
18 Jan 2011 04:33 PM
What does "does not work" mean exactly? Do you get an error message or just not the expected results?
dbandee
New Member
New Member

--
19 Jan 2011 07:46 AM
Msg 7630, Level 15, State 3, Line 16
Syntax error near 'John Smith' in the full-text search condition
gunneyk
New Member
New Member

--
19 Jan 2011 09:53 AM
I don't have FTS installed here to test but how about getting rid of the single quotes in the variable and just try this instead:

"John Smith*" OR "Jen Smith*"
rm
New Member
New Member

--
19 Jan 2011 10:18 AM
This works as gunneyk said:
set @CEOName = '"' + REPLACE(@CEOName, ',', '*" OR "') + '*"'
dbandee
New Member
New Member

--
21 Jan 2011 11:21 AM
Thank you very much
You are not authorized to post a reply.

Acceptable Use Policy