如何在SQL中启用全文检索功能?
2004-11-01 16:23
447 查看
全文索引的一个例子,在查询分析器中使用:
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
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
相关文章推荐
- 如何在SQL中启用全文检索功能?(实例)
- 如何在SQL中启用全文检索功能?
- 如何在SQL中启用全文检索功能?(实例)
- 如何在SQL中启用全文检索功能?(实例)
- 如何在SQL中启用全文检索功能?
- 如何在SQL中启用全文检索功能
- 如何在SQL中启用全文检索功能?
- 如何使用sql的全文检索功能
- 在SQL中启用全文检索功能
- 如何设置SQL 2005的全文检索功能
- 实例演示在SQL中启用全文检索
- 实例演示在SQL中启用全文检索
- 在Sql Server 中启用全文检索功能
- SQL 2005的全文检索功能怎么用
- sql 全文检索功能
- 如何使用Oracle全文检索功能
- 实例演示在SQL中启用全文检索
- 实例演示在SQL中启用全文检索
- 为web项目添加Lucene全文检索功能(Spring集成Lucene)
- 使用SQL SERVER 2000的全文检索功能