您现在的位置: 网页吧 > 技术文档 > 数据库 > MS_SQL > 正文
  • 站内搜索:

实例演示在SQL数据库中启用全文检索

[作者:未知 | 点击数: | 时间:2006-11-27]【

如何在SQL中启用全文检索功能?本文将通过实例向你剖折这个问题。这是一个全文索引的一个例子,首先在查询分析器中使用:

e pubs
 go

打开数据库全文索引的支持

ute sp_fulltext_database 'enable'
 go

建立全文目录ft_titles

ute sp_fulltext_catalog 'ft_titles', 'create'
  go

为titles表建立全文索引数据元,UPKCL_titleidind是主键所建立的唯一索引,可由sp_help titles得知

cute 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数据库中启用全文检索网友评论
发表评论
  • 姓 名 :* (必填项)
  • E-mail: QQ:
  • 评 分 : 1分 2分 3分 4分 5分
  • 评论内容:
·请遵守《互联网电子公告服务管理规定》及中华人民共和国其他各项有关法律法规。
·用户发表意见仅代表其个人意见,并且承担一切因发表内容引起的纠纷和责任。
·本站管理人员有权在不通知用户的情况下删除不符合规定的评论信息或留做证据。
·请客观的评价您所看到的资讯,提倡就事论事,杜绝漫骂和人身攻击等不文明行为。
网页吧·中国站长第一门户