-- 1. 查看数据库northwind 是否启用 全文索引 SELECT * FROM sys.databases
USE NorthWind
-- 2.创建全文目录
CREATE FULLTEXT CATALOG [ employee_fulltext ] WITH ACCENT_SENSITIVITY = OFF
AS DEFAULT
-- 3. 指定唯一索引
CREATE FULLTEXT INDEX ON [ dbo ] . [ Employees ]
KEY INDEX [ PK_Employees ] ON ( [ employee_fulltext ] ) WITH (CHANGE_TRACKING AUTO)
-- 4. 添加全文索引列
ALTER FULLTEXT INDEX ON [ dbo ] . [ Employees ] ADD ( [ Address ] )
go
ALTER FULLTEXT INDEX ON [ dbo ] . [ Employees ] ADD ( [ LastName ] )
go
ALTER FULLTEXT INDEX ON [ dbo ] . [ Employees ] ADD ( [ FirstName ] )
go
-- 5. 设置为可用
ALTER FULLTEXT INDEX ON [ dbo ] . [ Employees ] ENABLE
go
编辑器加载中...