-- 1、创建主键聚集索引 /****** Object: Index [PK_customerID] Script Date: 2018/8/10 16:36:21 ******/ ALTER TABLE [dbo].[userInfo] ADD CONSTRAINT [PK_customerID] PRIMARY KEY CLUSTERED ( [customerID] ASC ) ON [PRIMARY] GO -- 2、在“存储”-全文目录-新建全文 /****** Object: FullTextCatalog [test] Script Date: 2018/8/10 16:36:52 ******/ CREATE FULLTEXT CATALOG [test]WITH ACCENT_SENSITIVITY = ON AS DEFAULT GO -- 3、创建全文索引 CREATE FULLTEXT INDEX ON userInfo(customerName) KEY INDEX PK_customerID ON test GO -- 4、开始查询 SELECT * FROM dbo.userInfo WHERE CONTAINS(customerName,'"王" or "李"') GO
参考网址:https://www.red-gate.com/simple-talk/sql/learn-sql-server/full-text-indexing-workbench/