脚本方式添加全文索引

--脚本方式添加全文索引不是必需的,但有时可能不能使用企业管理器连接到SQL Server,我今天就刚好碰到这样的情况,顺便记下来,应该会有人也需要

--创建一个fulltext catalog
exec sp_fulltext_catalog 'catalogname', 'create'


--对目标表创建全文索引, 如果已经存在先删除, uniqueIndexName为目标表中的unique索引名(必需)
exec sp_fulltext_table 'tablename', 'drop'
exec sp_fulltext_table 'tablename', 'create', 'catalogname', 'uniqueIndexName'


--向全文索引添加需要索引的列
exec sp_fulltext_column 'tablename', 'column1', 'add', null,null
exec sp_fulltext_column 'tablename', 'column2', 'add', null,null

--激活全文索引
exec sp_fulltext_table 'tablename', 'activate'

原文地址:https://www.cnblogs.com/anchenjie007/p/1049674.html