它看起来像FREETEXTTABLE只允许搜索键参数作为变量,如下所示:
FROM FREETEXTTABLE(dbo.SampleTable, SampleColumn, @searchKey)我有一个列表searchKey值,大约50000条记录,如何与FREETEXTTABLE“连接”searchKey表
我曾经用过,但是它很慢
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.SampleTable表也很大,大约有1600万记录
发布于 2018-06-19 19:44:37
当前解决方案:使用c#多线程替换时间
https://stackoverflow.com/questions/50846580
复制相似问题