zoukankan      html  css  js  c++  java
  • sqlserver 实现数据库全文检索

    --在执行该脚本程序之前启动sql server的全文搜索服务,即microsoft search服务 
    use huarui_db --打开数据库 
    go 
    --检查huarui_db是否支持全文索引,如果不支持全文索引,则使用sp_fulltext_datebase打开该功能 
    if (select databaseproperty ('huarui_db','IsFulltextEnables'))=0 
    execute sp_fulltext_database 'enable' 
    --建立全文目录FullText_huarui_db 
    execute sp_fulltext_catalog 'FullText_huarui_db','create' 
    --为Products表建立全文索引数据元 
    execute sp_fulltext_table 'Products','create','FullText_huarui_db','PK_Products' 
    
    
    --设置全文索引列名 
    execute sp_fulltext_column 'Products','Product_name','add' 
    execute sp_fulltext_column 'Products','Product_type','add' 
    execute sp_fulltext_column 'Products','Category_name','add' 
    execute sp_fulltext_column 'Products','Memo1','add' 
    --建立全文索引 
    --execute sp_fulltext_table 'FullText_huarui_db','activate' 
    --填充全文索引目录 
    execute sp_fulltext_catalog 'FullText_huarui_db','start_full' 
    
    
    GO 
    --检查全文目录填充情况 
    WHILE FulltextCatalogProperty('FullText_huarui_db','PopulateStatus')<>0 
    BEGIN 
    --如果全文目录正处于填充状态,则等待30秒后再检测一次 
    	WAITFOR DELAY '0:0:30'
    END 
    --全文目录填充完成后,使用全文目录检索 
    --查询title列或notes列中包含有database或computer字符串的图书名称 
    SELECT * 
    FROM Products
    where contains(Product_name,'%1806%') 
    or contains(Product_type,'%1806%') 
    

      

  • 相关阅读:
    Jquery 公告 滚动+AJAX后台得到数据。
    图片上添加文字。
    javascript的window.onload与jquery的$(document).ready()
    后台JS写法
    Ajax xmlhttprequest原理(一)
    SQL语句二次排序。先根据是否置顶字段。再根据最后更新时间排序。
    引以为戒的SQL语句写法
    C#中var关键字怎么用 ~
    上传文件 解析
    简易公告
  • 原文地址:https://www.cnblogs.com/chenjt/p/3240076.html
Copyright © 2011-2022 走看看