An example of a full text index of SQL Server database
Author: Unknown Updated: Legume Source: ddvip.net Update Time: 2004.08.05 Submission-mail: tg * ddvip.com example of a complete SQL SERVER database full-text indexing.
(As an example of PUBS database) First, the specific steps of the creation of a full-text index using the system stored procedure: 1) Full-text processing function (sp_fulltext_database) 2) Set a full-text directory (sp_fulltext_catalog) 3) Registration in full-text directory requires a full-text index Table (sp_fulltext_table) 4) Indicates the list of column names that require full-text index (sp_fulltext_column) to create a full-text index (sp_fulltext_table) 6) fill full text directory (sp_fulltext_catalog) -------- **** **** Example ******* ------------ The full-text index is established with the Title and Notes columns of the Pubs database, and then use the index query Title column or notes column. Name of the Datebase or Computer String: Before this, you need to install Microsoft Search service, start SQL Server full-text search service USER PUBS - Open Database GO - Check if the database PUBS supports full-text index, if not support - use sp_fulltext_database turn the feature if (select databaseproperty ( 'pubs', 'isfulltextenabled')) = 0 execute sp_fulltext_database 'enable' - full-text catalog FT_PUBSexecute sp_fulltext_catalog 'FT_pubs', 'create' - execute full-text index data element table for the title sp_fulltext_table 'title', 'create', 'FT_pubs', 'UPKCL_titleidind' - set the full-text index column names to execute sp_fulltext_column 'title', 'title', 'add'execute sp_fulltext_column' title ',' notes ',' add'- - Establish full-text index -activate, is the full-text search capability of the activation table, that is, registered in the full-text directory EXECUTE SP_FULLTEXT_TABLE 'TITLE', 'ACTIVATE' - Full Text Index Directory Execute Sp_FullText_catalog 'ft_pubs',' Start_Full'go - Check the full-text catalog filler While F UlltextCatalogProperty ('ft_pubs',' populatestatus') <> 0begin - If the full-text catalog is in the filler, wait for 30 seconds, then detect a waitfor delay '0: 0: 30'end - full-text directory filled, ie You can retrieve Select TitleFormwhere Contains (Title, 'COMPUTER') or Contains (Notes, 'Database') or Contains (Notes, 'Database') '------- ------ The following describes the system stored procedure process name: SP_FULLTEXT_SERVICE execution permission: ServerAdmin or system administrator role: Set the full-text search attribute process name: sp_fulltext_catalog Execution Permissions: