SQL Server full-text index Usage Analysis

Source: Internet
Author: User
I believe everyone has some knowledge about SQLServer full-text indexing. The following describes the usage and related statements of SQLServer full-text indexing, we hope that you will have a better understanding of SQLServer full-text index. The code for copying is as follows: -- 1. Enable execfull-Text Index EXECsp_fulltext_databaseenable for the database -- 2. Create

I believe everyone has some knowledge about full-text indexing of SQL Server. The following describes the usage and related statements of full-text indexing of SQL Server, the code for enabling SQL Server full-text indexing is as follows: -- 1. enable SQL Server full-text indexing for the database EXEC sp_fulltext_database 'enable' -- 2. Create

I believe everyone has some knowledge about full-text indexing of SQL Server. The following describes the usage and related statements of full-text indexing of SQL Server, I hope you will have a better understanding of SQL Server full-text indexing.

The Code is as follows:


-- 1. enable full-text index of SQL Server for the database
EXEC sp_fulltext_database 'enable'

-- 2. Create a full-text directory
-- (If the error "full-text search not installed or a full-text component cannot be loaded" occurs, the service may not be started or not installed)
EXEC sp_fulltext_catalog 'ask91fable', 'create', 'd: Data2005Ask_91_Index'

-- 3. Specify the table for full-text search
-- (The error "... full-text search key must be a unique, non-empty, and single-column index, and this index is not offline ...")
-- (This table must have a unique index [primary key is acceptable],)

EXEC sp_fulltext_table 'ask', 'create', 'ask91fable', 'pk _ Ask '-- unique index name

-- 4. Add columns to the full-text directory
EXEC sp_fulltext_column 'ask', 'subobject', 'add'
EXEC sp_fulltext_column 'ask', 'detail', 'add'

-- 5. Activate the full-text directory
EXEC sp_fulltext_table 'ask', 'activate'

-- Fill
EXEC sp_fulltext_table 'ask', 'start _ full' -- completely filled
-- EXEC sp_fulltext_table 'ask', 'start _ incremental '-- incremental filling

-- Rebuilding (should be fully filled after Reconstruction)
-- EXEC sp_fulltext_catalog 'ask91fable', 'rebuilt'

-- Call (1 million data ,)
-- Select top 1 * FROM Asks

Select id from Asks WHERE Subject LIKE '% NET Summary %' OR Detail LIKE '% NET Summary %' -- 2 minutes 33 seconds
Select id from Asks where contains (Asks. *, 'net summary') -- 0 minutes 40 seconds

Select id from Asks WHERE Subject LIKE '% NET Summary %' -- 0 minutes 42 seconds
Select id from Asks where contains (Asks. Subject, 'net summary') -- 0 minutes 26 seconds

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.