Make SQL Server index small numbers

后端 未结 3 612
攒了一身酷
攒了一身酷 2021-01-18 07:51

We\'re using SQL Server 2005 in a project. The users of the system have the ability to search some objects by using \'keywords\'. The way we implement this is by creating a

3条回答
  •  醉梦人生
    2021-01-18 08:45

    You can combine CONTAINS (or CONTAINSTABLE) with simple where conditions:

    SELECT * FROM Movies WHERE CONTAINS(Title, '"Terminator 2"') and Title like '%Terminator 2%'

    While the CONTAINS find all Terminator the where will eliminate 'Terminator 1'.

    Of course the engine is smart enough to start with the CONTAINS not the like condition.

提交回复
热议问题