Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize full-text Retrieval in SQLServer Database

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Today, I will talk to you about how to achieve full-text retrieval in the SQLServer database, many people may not know much about it. In order to make you understand better, the editor summarized the following content for you. I hope you can get something according to this article.

How to realize full-text Retrieval in SQLServer Database

(1) start the full-text processing function of the database (sp_fulltext_datebase)

(2) establish full-text catalogue (sp_fulltext_catalog)

(3) register tables that require full-text indexing in the full-text catalog (sp_fulltext_table)

(4) indicate the column names in the table that require full-text retrieval (sp_fulltext_column)

(5) create a full-text index for the table (sp_fulltext_table)

(6) populate full-text index (sp_fulltext_catalog).

How to realize full-text Retrieval in SQLServer Database

Start sqlserver's full-text search service, the microsoftsearch service, before executing the script.

Usepubs-- opens the database go

-- check if pubs supports full-text indexing, and if not, use sp_fulltext_datebase to turn on the feature.

If (selectdatabaseproperty ('pubs','IsFulltextEnables')) = 0 executespice fulltext database enable.'

-- establish a full-text catalog FT_pubs.

Executesp_fulltext_catalog'FT_pubs','create'

-- create a full-text index data element for the titles table.

Executesp_fulltext_table'titles','FT_pubs','UPKCL_titleidind'

-- sets the full-text index column name.

Executesp_fulltext_column'titles','title','add'executesp_fulltext_column'titles','notes','add'

-- establish a full-text index.

Executesp_fulltext_table'FT_pubs','activate'

-- populate the full-text index catalog.

Executesp_fulltext_catalog'FT_pubs','start_full'GO

-- check the filling of full-text catalogs.

WHILEFulltextCatalogProperty ("FT_pubs','PopulateStatus') 0BEGIN

If the full-text catalog is populated, wait 30 seconds and then check again.

WAITFORDELAY'0:0:30'END

-- after filling in the full-text catalog, use the full-text catalog for retrieval.

Query the name of a book that contains a database or computer string in the title column or the notes column.

SELECTtitleFROMtitlewhereCONTAINTS (title,'database') orcontains (notes,'database') orcontains (title,'computer') orcontains (notes,'computer')

After reading the above, do you have any further understanding of how to realize full-text retrieval in SQLServer database? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report