Example demo enable Full-text search in SQL

Source: Internet
Author: User
How can Full-text search enable Full-text search in SQL? This article will break this problem to you through an example. This is an example of a Full-text index that is first used in Query Analyzer:
Use pubs
Go

--Support for open database Full-text indexing

Execute sp_fulltext_database ' Enable '
Go

--Create a Full-text catalog Ft_titles

Execute sp_fulltext_catalog ' ft_titles ', ' create '
Go

--To create a full-text indexed data element for the titles table, Upkcl_titleidind is the only index established by the primary key, which can be learned by sp_help titles

Execute sp_fulltext_table ' titles ', ' Create ', ' ft_titles ', ' upkcl_titleidind '
Go

--Set full-text index column names

EXEC sp_fulltext_column ' titles ', ' title ', ' Add '
Go
EXEC sp_fulltext_column ' titles ', ' Notes ', ' add '
Go

--Establish Full-text indexing

EXEC sp_fulltext_table ' titles ', ' Activate '
Go

--Populating Full-text index catalogs

EXEC sp_fulltext_catalog ' ft_titles ', ' start_full '
Go

--Using CONTAINS and FREETEXT

Select title, notes from titles
where contains (title, ' "Computer Cooking")
Go
Select title, notes from titles
where FREETEXT (title, ' Computer Cooking ')
Go
Select title, notes from titles
where FREETEXT (title, ' "Computer Cooking")
Go
Select title, notes from titles
where contains (title, ' computer ')
Go
Select title, notes from titles
where FREETEXT (*, ' computer ')
Go


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.