


实例演示在MSSQL中启用全文检索
如何在SQL中启用全文检索功能?本文将通过实例向你剖折这个问题。这是一个全文索引的一个例子,首先在查询分析器中使用:
use pubs
go
--打开数据库全文索引的支持
execute sp_fulltext_database ''enable''
go
--建立全文目录ft_titles
execute sp_fulltext_catalog ''ft_titles'', ''create''
go
--为titles表建立全文索引数据元,UPKCL_titleidind是主键所建立的唯一索引,可由sp_help titles得知
execute sp_fulltext_table ''titles'',''create'', ''ft_titles'', ''UPKCL_titleidind''
go
--设置全文索引列名
exec sp_fulltext_column ''titles'', ''title'', ''add''
go
exec sp_fulltext_column ''titles'', ''notes'', ''add''
go
--建立全文索引
exec sp_fulltext_table ''titles'', ''activate''
go
--填充全文索引目录
exec sp_fulltext_catalog ''ft_titles'', ''start_full''
go
--使用contains和freetext
select title, notes from titles
where contains(title, ''"computer Cooking"'')
go
select title, notes from titles
where freetext(title, ''computer Cooking'')
go
select title, notes from titles
where freetext(title, ''"computer Cooking"'')
go
select title, notes from titles
where contains(title, ''computer'')
go
select title, notes from titles
where freetext (*, ''computer'')
go
关键字:全文检索、MSSQL
新文章:
- CentOS7下图形配置网络的方法
- CentOS 7如何添加删除用户
- 如何解决centos7双系统后丢失windows启动项
- CentOS单网卡如何批量添加不同IP段
- CentOS下iconv命令的介绍
- Centos7 SSH密钥登陆及密码密钥双重验证详解
- CentOS 7.1添加删除用户的方法
- CentOS查找/扫描局域网打印机IP讲解
- CentOS7使用hostapd实现无AP模式的详解
- su命令不能切换root的解决方法
- 解决VMware下CentOS7网络重启出错
- 解决Centos7双系统后丢失windows启动项
- CentOS下如何避免文件覆盖
- CentOS7和CentOS6系统有什么不同呢
- Centos 6.6默认iptable规则详解