构建TSQL全文搜索XOR

时间:2016-01-19 15:03:52

标签: sql-server tsql full-text-search containstable

我有一张包含以下文本数据的表格:

  1. Linker
  2. Linker pagina
  3. Rechter pagina
  4. 我正在使用CONTAINSTABLE。当我使用以下全文表达式"Linker*" AND "pagina*"时,仅返回第二个记录。

    我已尝试使用表达式("Linker*" OR "pagina*") AND NOT ( "pagina*" AND "Linker*")构建XOR,但会返回所有记录。

    为什么?

1 个答案:

答案 0 :(得分:1)

我试过这个

SELECT * FROM CONTAINSTABLE(data,*,'"Linker*" OR "pagina*"') AS Results
WHERE Results.[KEY] NOT IN
(SELECT [Key] FROM CONTAINSTABLE(data,*,'"Linker*" AND "pagina*"'))

回复给我: enter image description here

您也可以尝试" AND NOT" AND本身的CONTAINSTABLE如下:

update  fs 
set top (10) fs.testrun = getdate()  
from datFS fs with (rowlock)
join datAE t2 with (nolock)
     on fs.fsID = t2.fsID
join @AllCompletedNotYetDeleted t1
     on fs.fsID = t1.fsID
where DateSent < DATEADD(m, -6, GETDATE())

这是回报: enter image description here