Sql 带有列表搜索键的 FREETEXTTABLE

Sql FREETEXTTABLE with list searchkey

看起来 FREETEXTTABLE 只允许 searchkey 参数作为变量,像这样:

FROM FREETEXTTABLE(dbo.SampleTable, SampleColumn, @searchKey)

我有一个列表 searchKey 值,大约 50000 条记录,如何 "JOIN" searchKey table with FREETEXTTABLE

我用过 WHILE,但速度很慢

DECLARE @results as table(
    Key NVARCHAR(100),
    Rank INT
)

declare @numberOfRows INT = SELECT MAX(Id) FROM dbo.SearchKeyTable)
declare @step int = (SELECT MIN(Id) FROM dbo.SearchKeyTable)

WHILE (@step <= @numberOfRows)
BEGIN
    declare @searchKey NVARCHAR(500) = (Select TOP(1) '''' + REPLACE([Description], '''', '"')  + ''' OR ''' + REPLACE([itemname], '''', '"') + '''' From dbo.SearchKeyTable where id = @step ORDER BY Id)

    insert into @results
    select [Key] as KeyId, SUM([Rank]) as TotalRank FROM FREETEXTTABLE(dbo.SampleTable, SampleColumn, @searchKey) GROUP BY [Key]

    SET @step = @step + 1
END

select * from @results

我的dbo.SampleTabletable也很大,大概1600万记录

目前解决方案:用c#多线程代替WHILE