实例演示在MSSQL中启用全文检索[MSSQL防范]
本文“实例演示在MSSQL中启用全文检索[MSSQL防范]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:
如安在SQL中启用全文检索功效?本文将通过实例向你剖折这个问题.这是一个全文索引的一个例子,首先在查询解析器中利用:www.c hinaitpower.coml1odLWyQ
use pubs
go www.c hinaitpower.coml1odLWyQ
--翻开数据库全文索引的支持www.c hinaitpower.coml1odLWyQ
execute sp_fulltext_database ''enable''
go www.c hinaitpower.coml1odLWyQ
--成立全文目录ft_titles
execute sp_fulltext_catalog ''ft_titles'', ''create''
go www.c hinaitpower.coml1odLWyQ
--为titles表成立全文索引数据元,UPKCL_titleidind是主键所成立的唯一索引,可由sp_help titles得知
execute sp_fulltext_table ''titles'',''create'', ''ft_titles'', ''UPKCL_titleidind''
go www.c hinaitpower.coml1odLWyQ
--设置全文索引列名
exec sp_fulltext_column ''titles'', ''title'', ''add''
go
exec sp_fulltext_column ''titles'', ''notes'', ''add''
go www.c hinaitpower.coml1odLWyQ
--成立全文索引
exec sp_fulltext_table ''titles'', ''activate''
go www.c hinaitpower.coml1odLWyQ
--填充全文索引目录
exec sp_fulltext_catalog ''ft_titles'', ''start_full''
go www.c hinaitpower.coml1odLWyQ
--利用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中启用全文检索[MSSQL防范]”的内容,如果你对以上该文章内容感兴趣,你可以看看七道奇为您推荐以下文章:
本文地址: | 与您的QQ/BBS好友分享! |