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: www.c Hinaitpower.coml1odlwyq
Use pubs
Go www.c hinaitpower.coml1odlwyq
--Support for Open database Full-text indexing www.c hinaitpower.coml1odlwyq
Execute sp_fulltext_database ' Enable '
Go www.c hinaitpower.coml1odlwyq
--Create a Full-text catalog Ft_titles
Execute sp_fulltext_catalog ' ft_titles ', ' create '
Go www.c hinaitpower.coml1odlwyq
--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 www.c hinaitpower.coml1odlwyq
--Set full-text index column names
EXEC sp_fulltext_column ' titles ', ' title ', ' Add '
Go
EXEC sp_fulltext_column ' titles ', ' Notes ', ' add '
Go www.c hinaitpower.coml1odlwyq
--Establish Full-text indexing
EXEC sp_fulltext_table ' titles ', ' Activate '
Go www.c hinaitpower.coml1odlwyq
--Populating Full-text index catalogs
EXEC sp_fulltext_catalog ' ft_titles ', ' start_full '
Go www.c hinaitpower.coml1odlwyq
--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