【问题标题】:SQL Contains not working on full text index with preceding *SQL 包含不适用于带有前面 * 的全文索引
【发布时间】:2012-12-29 22:35:57
【问题描述】:
select top 10 * from table where contains(*,'"abc*"') 

工作并返回 6 行

abcdef

abcd

abcd

abcde

ABCDEFGH

ABCDEFG

select top 10 * from table where contains(*,'"*bc*"') 

返回未找到记录。

有谁知道我怎样才能让 '"*bc*"' 函数工作?

【问题讨论】:

    标签: sql sql-server-2008 full-text-search fulltext-index full-text-catalog


    【解决方案1】:

    试试

    select top 10 * from table where contains(*,'%bc%') 
    

    select op 10 * from table where COLUMN_NAME LIKE '%bc%'
    

    【讨论】:

      【解决方案2】:

      领先的通配符搜索将排除使用任何索引...包括全文索引。

      所以"*bc*" 与全文索引不兼容...并且诸如LIKE '%bc%' 之类的非全文搜索将导致全表扫描。

      相关问题:

      SQL Server Full Text Search Leading Wildcard

      How do you get leading wildcard full-text searches to work in SQL Server?

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-02-14
        • 1970-01-01
        • 1970-01-01
        • 2020-02-03
        • 2019-11-30
        • 1970-01-01
        • 2021-12-17
        • 1970-01-01
        相关资源
        最近更新 更多