An example of a complete Full-text index for a SQL Server database
Source: Internet
Author: User
An example of a complete Full-text index for a SQL Server database. (for example, in the pubs database)
First, describe the steps to create a FULL-TEXT index using system stored procedures:
1 full-text processing of the start database (sp_fulltext_database)
2) Establishment of Full-text catalogs (sp_fulltext_catalog)
3 to register a table in the Full-text catalog that requires Full-text indexing (sp_fulltext_table)
4 indicates the column names in the table that require Full-text indexing (sp_fulltext_column)
5 Create a Full-text index for a table (sp_fulltext_table)
6) Populating 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 '
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.