您好,欢迎来到思海网络,我们将竭诚为您提供优质的服务! 诚征网络推广 | 网站备案 | 帮助中心 | 软件下载 | 购买流程 | 付款方式 | 联系我们 [ 会员登录/注册 ]
促销推广
客服中心
业务咨询
有事点击这里…  531199185
有事点击这里…  61352289
点击这里给我发消息  81721488
有事点击这里…  376585780
有事点击这里…  872642803
有事点击这里…  459248018
有事点击这里…  61352288
有事点击这里…  380791050
技术支持
有事点击这里…  714236853
有事点击这里…  719304487
有事点击这里…  1208894568
有事点击这里…  61352289
在线客服
有事点击这里…  531199185
有事点击这里…  61352288
有事点击这里…  983054746
有事点击这里…  893984210
当前位置:首页 >> 技术文章 >> 文章浏览
技术文章

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

添加时间:2012-12-24 17:27:46  添加: 思海网络 


如何在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

 

关键字:全文检索、MSSQL

分享到:

顶部 】 【 关闭
版权所有:佛山思海电脑网络有限公司 ©1998-2024 All Rights Reserved.
联系电话:(0757)22630313、22633833
中华人民共和国增值电信业务经营许可证: 粤B1.B2-20030321 备案号:粤B2-20030321-1
网站公安备案编号:44060602000007 交互式栏目专项备案编号:200303DD003  
察察 工商 网安 举报有奖  警警  手机打开网站