熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> MySQL >> 正文

SQL

2022-06-13   來源: MySQL 
SQL Server全文索引相信大家都有一定的了解下面就為您介紹SQL Server全文索引的用法及相關的語句希望可以讓您對SQL Server全文索引能有更深的認識   復制代碼 代碼如下:

  
為數據庫啟用SQL Server全文索引
EXEC sp_fulltext_database enable

  創建全文目錄
(此處若出錯“未安裝全文搜索或無法加載某一全文組件”則可能是未啟動或未安裝此服務)
EXEC sp_fulltext_catalog AskFable create D:DataAsk__Index

  指定要進行全文搜索的表
(可能出錯“全文搜索鍵必須是唯一的不可為空的單列的索引並且該索引不是離線的”)
(這個表必須有一個唯一索引[主鍵是可以的])

  EXEC sp_fulltext_table Asks create AskFable PK_Ask唯一索引名稱

  向全文目錄中添加列
EXEC sp_fulltext_column Asks Subject add
EXEC sp_fulltext_column Asks Detail add

  激活全文目錄
EXEC sp_fulltext_table Asks activate

  填充
EXEC sp_fulltext_table Asks start_full完全填充
EXEC sp_fulltext_table Asks start_incremental增量填充

  重建(重建之後應該完全填充)
EXEC sp_fulltext_catalog AskFable rebuild

  調用(萬數據)
SELECT TOP * FROM Asks

  SELECT ID FROM Asks WHERE Subject LIKE %NET小結% OR Detail LIKE %NET小結%
SELECT ID FROM Asks WHERE CONTAINS (Asks*NET小結)

  SELECT ID FROM Asks WHERE Subject LIKE %NET小結%
SELECT ID FROM Asks WHERE CONTAINS (AsksSubjectNET小結)


From:http://tw.wingwit.com/Article/program/MySQL/201311/29523.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.