Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 How to use parameter is full-text search sp

Author  Topic 

philco
Starting Member

1 Post

Posted - 2001-11-23 : 22:56:25
I am using SQL Server 7. I'm new to full-text searches.

I have a full-text catalog on Artists.FName and Artists.LName called Artists_Catalog. In Query Analyzer this works:

select distinct ArtistID, LName, FName
from Artists
WHERE contains(Artists.*, '"jOHN*"')
order by Artists.LName

However, when I try to create a store proc version in which I can pass a string in as the search parameter, it won't compile. Error 170 reported at @strQuery in where clause.

CREATE procedure spSearchArtists
@strQuery varchar(128) as
select distinct ArtistID, LName, FName
from Artists
where contains(Artists.*, @strQuery)
order by Artists.LName
return

Not sure where I'm going wrong on the syntax. Can someone help out?

thanks!
philco

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2001-11-26 : 15:58:33
Try using Dynamic SQL. See Merkin's articles at
[url]http://www.sqlteam.com/item.asp?ItemID=4599[/url] and
[url]http://www.sqlteam.com/item.asp?ItemID=4619[/url]

-------------------
It's a SQL thing...
Go to Top of Page
   

- Advertisement -