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

时间:2011-10-01 14:01:37 

如何在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
标签:全文搜索,sql,全文索引
0
投稿

猜你喜欢

  • MySQL中随机生成固定长度字符串的方法

    2010-12-08 16:25:00
  • mysql数据库你需要特别注意的23个事项

    2010-08-08 08:34:00
  • 慢慢的网页

    2009-11-12 12:53:00
  • 23条科学设计你网站的方法

    2008-03-23 14:12:00
  • DNS优化的原理和方法

    2012-04-26 16:43:56
  • javascript 密码强度验证规则、打分、验证

    2010-05-18 19:58:00
  • 数据库安全管理的三个经验分享

    2009-04-01 15:49:00
  • Silverlight VS Flash,谁更强?

    2008-11-07 11:04:00
  • 在ASP中使用SQL语句之12:连接

    2009-04-23 18:27:00
  • Javascript 中 String.replace( ) 的妙用

    2008-08-05 18:08:00
  • 很无聊的一个找碴游戏

    2008-07-02 13:10:00
  • 专家教你安装 MySQL的与MySQL GUI Tools

    2012-01-29 17:59:05
  • 游戏的用户体验营销小札

    2009-08-30 15:13:00
  • js插入flash可防止虚线框激活

    2009-03-13 13:31:00
  • ASP实现GB2312转UTF-8函数

    2009-02-26 13:08:00
  • 使IE浏览器支持PNG格式图片的透明效果

    2008-02-02 16:20:00
  • asp 去掉html中的table正则代码函数

    2011-04-06 10:48:00
  • 用js更好地截取定长字符串

    2008-01-16 12:48:00
  • oracle 分页 很棒的sql语句

    2009-07-02 11:44:00
  • 让你的主页声色并茂—巧为网页添加背景音乐

    2010-09-02 12:35:00
  • asp之家 网络编程 m.aspxhome.com