I am really having trouble with a full-text search query. Here's what I've got:
SELECT listing_id, RANK, name, address, city, zip, heading, phone
FROM listings a,
FREETEXTTABLE(listings, *, 'FormsOf(INFLECTIONAL, tax')
WHERE [KEY] = a.listing_id
ORDER BY RANK DESC, name
When I hard code the value 'tax' into the query, it returns over 500 results. But when I try and do it with a variable, it treats it as null:
DECLARE @SearchWord nvarchar(4000)
SET @SearchWord = 'tax'
SELECT listing_id, RANK, name, address, city, zip, heading, phone
FROM listings a,
FREETEXTTABLE(listings, *, 'FormsOf(INFLECTIONAL, @SearchWord')
WHERE [KEY] = a.listing_id
ORDER BY RANK DESC, name
HOW HOW HOW??!?!? do I do this query with a variable? Clearly there is a way! The possibilitied for what a user could search for are endless and I can't have any values hard-coded in the query. I have tried everything I can think of and nothing has worked, and I have searched Google like CRAZY and have found no help - every example has a value hard coded in.
Surely I am not the first person to have run into this problem!!! Where is the solution???
Thank you!!!!!
Casey