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 2005 Forums
 Transact-SQL (2005)
 CROSS APPLY a FREETEXTTABLE

Author  Topic 

meyerovb
Starting Member

1 Post

Posted - 2010-09-13 : 19:39:51
table1 has a full text index. I want to run multiple freetexttable searches against it in a single query, but the two attempts i have fail. any help would be appreciated, thanks!

[CODE]
CREATE FUNCTION fnt_FullTextSearch ( @s NVARCHAR(4000) )
RETURNS TABLE
AS
RETURN
( SELECT [key], [rank]
FROM FREETEXTTABLE(table1, *, @s) )

DECLARE @terms TABLE ( term VARCHAR(MAX) )
INSERT INTO @terms VALUES ( 'flu' )
INSERT INTO @terms VALUES ( 'acid' )

--The inline function "..." cannot take correlated parameters or subqueries
-- because it uses a full-text operator.
SELECT ft.[key], ft.[rank]
FROM @terms
CROSS APPLY fnt_FullTextSearch(term) ft

--syntax error on term
SELECT ft.[key], ft.[rank]
FROM @terms
CROSS APPLY FREETEXTTABLE(table1, *, term)
[/CODE]
   

- Advertisement -