在SQLServer2005中使用全文搜索是一种占用空间的操作。它将维护一个文件保存关键字。具体使用方法如下:
启用全文搜素(先选择哪个数据库)
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->exec sp_fulltext_database 'enable'
创建一个全文搜索,名为:FS_Name, 索引目录存储地址可以省略(省略则为默认)
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->exec sp_fulltext_catalog 'FC_Name', 'create'
为该全文搜索创建一个针对表T1的搜索(主键名:PK_Key)
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->exec sp_fulltext_table 'T1', 'create', 'FC_Name', 'PK_Key'
为针对t1表的全文搜索添加1列,列名:C1
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->exec sp_fulltext_column 'T1', 'C1', 'add'
另外,我们需要创建一项作业来向这个全文搜素中填充数据:(执行填充代码如下)
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->exec sp_fulltext_table 'T1', 'start_full'
T-SQL检索语句:
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->select * from T1 where contains ([C1],'keyword')
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/16436858/viewspace-623301/
,如需转载,请注明出处,否则将追究法律责任。