用户名:
密 码: 记住
您当前的位置:首页 > 网络编程 > sqlserver教程

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

时间:2014-11-30  来源:互联网  作者:佚名

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

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

来顶一下
返回首页
返回首页
推荐资讯
从零开始学ASP.NET-基础篇第1/7页 从零开始学ASP.NET-基础篇第1/7页第一天 学习目的: 掌握最基本的Label、TextBox、Button控件
ASP.NET入门数据篇 ASP.NET入门数据篇对于网站编程的初学者来说,总是会上网找些源码来看,但久而
相关文章
栏目更新
栏目热门