如何使用SQL Server 2000全文檢索

2021-03-31 08:57:01 字數 2231 閱讀 1271

一、如何在sql中啟用全文檢索功能

1、驗證全文檢索服務是否安裝

通過儲存過程fulltextserviceproperty(返回有關全文服務級別屬性的資訊)來驗證搜尋服務(全文元件)是否安裝。如select fulltextserviceproperty (『isfulltextinstalled』):返回1表示已安裝全文元件;返回0表示未安裝全文元件;返回null表示輸入無效或發生錯誤。

2、啟動全文檢索服務(mircosoft search)

3、開啟資料庫全文索引的支援

為全文索引啟用資料庫:

use northwind

exec sp_fulltext_database  『enable』

從資料庫中刪除所有目錄:

use northwind

exec sp_fulltext_database 『disable』

二、建立全文目錄

1、建立全文目錄

use northwind

exec sp_fulltext_catalog 'ft_ catalog ', 'create'

2、重建全文目錄

use northwind

exec sp_fulltext_catalog 'ft_ catalog ', ' rebulid'

3、啟動全文目錄的填充

use northwind

exec sp_fulltext_catalog 'ft_ catalog ', 'start_full'

4、停止全文目錄的填充

use northwind

exec sp_fulltext_catalog 'ft_ catalog ', 'stop'

5、刪除全文目錄

use northwind

pk_products

exec sp_fulltext_catalog 'ft_ catalog ', 'drop'

三、為表建立全文索引資料元

1、建立的唯一索引

use northwind

exec sp_fulltext_table 'products','create', 'ft_ catalog', ' pk_products '

2、設定全文索引列名

use northwind

exec sp_fulltext_table 'products','create', 'ft_ catalog', ' pk_products '

3、設定全文索引列名

use northwind

exec sp_fulltext_column ' products ', productname', 'add'

goexec sp_fulltext_column ' products ', quantityperunit', 'add'

go4、啟用全文索引

use northwind

exec sp_fulltext_table 'products','activate

5、填充全文索引目錄

use northwind

exec sp_fulltext_catalog 'ft_ catalog ', 'start_full'

四、使用transact-sql進行全文檢索,我們使用contains、freetext等謂詞

1、檢索productname中,即包含b又包含c的所有列

use northwind

select *

from products

where contains(productname, '"c*" and "b*" ')

2、檢索productname中,即包含chai chang tofu之一的所有列

use northwind

select *

from products

where freetext(productname, 'chai chang tofu ')

五、全文查詢有關的系統儲存過程

(1)啟動資料庫的全文處理功能(sp_fulltext_datebase);

(2)建立全文目錄(sp_fulltext_catalog);

(3)在全文目錄中註冊需要全文索引的表(sp_fulltext_table);

(4)指出表中需要全文檢索的列名(sp_fulltext_column)

(5)為表建立全文索引(sp_fulltext_table);

(6)填充全文索引(sp_fulltext_catalog)。

如何五分鐘完全解除安裝sqlserver 2012

之前因為專案的的需要安裝了sqlserver2012。但是,之後也沒有怎麼用到,基本上使用08 r2版的就可以解決平時專案的開發。所以,今日mark一下,如何完整解除安裝sqlserver 2012。開啟控制面板 程式 解除安裝程式 microsoft sql server 2012 雙擊即可,如下...

怎樣將備份資料匯入sql server2000

朋友將sql server2000中的一個資料庫備份為abc.bak 現在在我的機器上想使用它,請問怎麼才能將資料庫還原和匯入,1.window程式選單 2.sql server 200 企業管理器 3.sql server組 機器名稱 資料庫 右鍵 4.所有任務 還原資料庫 5.a 常規 選項卡 ...

將txt檔案匯入到SQL server2000中

最近在做一個小專案,用的資料庫是sql server,現在遇到一個問題,就是局方提供了一個txt文字,這個文字里面有幾百條資料,需要將這幾百條資料匯入到資料庫中,我在網上搜尋到的方法如下,create table h2t sp dm spdm varchar 10 spmc varchar 100 ...

新版資料庫分頁方法(Sql server2012)

1.row number 的分頁方法 dbcc freeproccache dbcc dropcleanbuffers setstatistics time on setstatistics io on setstatistics profile on with pager as select id...

九月微軟將火熱推出SQL Server 2005

微軟開發者部門的產品經理prashant sridharan透露,軟體巨人計劃下月在洛杉磯召開的專業開發者大會上推出一個 釋出候選 版本的visual studio 2005以及一個 社群技術預覽 版本的sql server 2005 sridharan說,這兩種軟體將在在11月7日向所有使用者推出...