I have a Full Text query that works fine when structured as follows:
SELECT First_Name, Middle_Name, Last_Name, Hire_Date, City, Department, Phone_Ext, title, Fax, Secretary_Name, Attorney_Name, Secy_Ext, Home_Phone, Desk_Location, Law_School, Undergraduate_School, Languages, E_mail, CMS_ID, WEB_ID, Notary
FROM dbo.PhotoDir
WHERE CONTAINS (*, 'Jones')
ORDER BY Last_Name, First_Name
However, I would like to replace "Jones" with a parameter, @.LName for example. However, I can't figure out the syntax. I tried the following:
WHERE CONTAINS (*, @.LName)
but received the following error:
The @.LName SQL construct or statement is not supported.
Is there a way to put a parameter in this type of query?
Thanks in advance.
Hi There,
Have a look at this article, mnight give you a clue on what you doing there.
http://technet.microsoft.com/en-us/library/ms187787.aspx
Hope it helps!
|||Hi lwhalen618,
See this example in sql2005 online book:
USE AdventureWorks;GODECLARE @.SearchWord nvarchar(30)SET @.SearchWord = N'Performance'SELECT Description FROM Production.ProductDescription WHERE CONTAINS(Description, @.SearchWord);GO
See, it's totally fine to use parameter within full-text-indexing. Your code seems okay to me. Please check if you have declared @.LName in your code.
Hope my suggestione helps
|||
I was able to get my code to work using a stored procedure. The query builder within VS2005 would not let me use the additional code before the Select statement.
Thanks for your help.
没有评论:
发表评论