An example of a complete Full-text index for a SQL Server database _mssql

Source: Internet
Author: User

first, describe the steps to create a FULL-TEXT index using system stored procedures:
1To start the Full-text processing of the database (sp_fulltext_database)
2) to establish a Full-text catalog (sp_fulltext_catalog)
3Registers the table that requires Full-text indexing in the Full-text catalog (sp_fulltext_table)
4Indicates the column name in the table that requires a Full-text index (sp_fulltext_column)
5To create a Full-text index for the table (sp_fulltext_table)
6) Populate Full-text catalogs (sp_fulltext_catalog)

---------******** sample ********-------------
To establish a Full-text index on the title and notes columns of the pubs database, and then use the index query title column or the book name that contains the Datebase or computer string in the Notes column:
Before that, you need to install the Microsoft Search service to start the SQL Server Full-text Search service
User Pubs--Open database
Go
--Check to see if the database pubs support Full-text indexing if you do not support
--use sp_fulltext_database to turn on the feature
if (select Databaseproperty (' pubs ', ' isfulltextenabled ')) =0
Execute sp_fulltext_database ' Enable '
--Create a Full-text catalog Ft_pubs
Execute sp_fulltext_catalog ' ft_pubs ', ' create '
--Create a full-text indexed data element for the title table
Execute sp_fulltext_table ' title ', ' Create ', ' ft_pubs ', ' upkcl_titleidind '
--Set full-text index column names
Execute sp_fulltext_column ' title ', ' title ', ' Add '
Execute sp_fulltext_column ' title ', ' Notes ', ' add '
--Establish Full-text indexing
--activate is the ability to activate the Full-text retrieval of a table, that is, to register the table in a Full-text catalog
Execute sp_fulltext_table ' title ', ' Activate '
--Populating Full-text index catalogs
Execute sp_fulltext_catalog ' ft_pubs ', ' start_full '
Go
--Check Full-text catalog fill
While FullTextCatalogProperty (' ft_pubs ', ' populatestatus ') <>0
Begin
--If the Full-text catalog is in a filled state, wait 30 seconds before testing again
WAITFOR DELAY ' 0:0:30 '
End
--When the Full-text catalog population is complete, you can use the Full-text catalog to retrieve
Select title
form
where CONTAINS (title, ' database ')
or CONTAINS (title, ' computer ')
or CONTAINS (notes, ' database ')
or CONTAINS (notes, ' database ')

' --------------The following describes the system stored procedures of the Full-text operation class
procedure name: Sp_fulltext_ Service
Execute permissions: serveradmin or system administrator
role: Set full-Text Search Properties
procedure name: sp_fulltext_catalog
Execute permissions: DB_Owner and higher role members
role: Create and delete a Full-text catalog, start or stop index operations for a Full-text catalog
procedure name: Sp_fulltext_database
Execute permissions: db_owner role member
role: Initialize full-text indexing or delete all Full-text catalogs in a database
procedure name: sp_fulltext_table
Execute permission: db_ Ddladnmin or db_owner role member
role: To identify a table as a full-text indexed table or a non-full-text indexed table
procedure name: Sp_fulltext_column
Execute permission: db_ Ddladnmin role member
role: Indicates those columns in a full-text indexed table if or when you exit the Full-text index

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.