您的位置:首页 > 数据库

SQL Server 2005 全文检索

2007-03-24 13:01 288 查看
首先确认安装了全文检索组件和服务,主要是Express版本,它默认是不安装的,企业版和开发版默认是安装的

1、允许数据库使用全文索引,
在SQL Server Management Studio中选择要操作的数据库的右键菜单中的属性,在属性窗口中的Files页面,有Use full-text indexing,勾选这个复选框就可以了。
create fulltext catalog catalogname
运行完此命令,会在sql的安装目录下产生一个缓存文件夹:

create unique index indexname on talbename(columnname)
4、创建全文索引
根据之前的full-text catalog和unique index在同一表上创建全文索引

create fulltext index on tablename(column1,colunmn2,)
key index indexname on catalogname
with change_tracking auto
5、使用全文检索函数contains,
完成上面的一系列工作后,就可以在查询中使用全文索引函数contains

where contains(column, '"a" and "b" not "c"')
where contains(column, '"abc"')
where contains(column, '"a" and "b" and "c"')
where contains(column, '"a" near "b"')
where contains(column, 'formsof(inflectional, "happy")')
matches "happy", "happier", "happiest", "happily".

contains(column, 'isabout("computer" weight(0.5), "software" weight(2.0),
"development" weight(10.0)) rankmethod inner product')
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: