如何在SQL中启用全文检索功能?本文将通过实例向你剖折这个问题。这是一个全文索引的一个例子,首先在查询分析器中使用:
go
打开数据库全文索引的支持
go
建立全文目录ft_titles
go
为titles表建立全文索引数据元,UPKCL_titleidind是主键所建立的唯一索引,可由sp_help titles得知
go
设置全文索引列名
go
exec sp_fulltext_column 'titles', 'notes', 'add'
go
建立全文索引
go
填充全文索引目录
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
延伸阅读
文章来源于领测软件测试网 https://www.ltesting.net/