![]() |
Database »
Database »
SQL Server
Beginner
License: The Code Project Open License (CPOL)
SQL SERVER - 2008 - Creating Full Text Catalog and Full Text SearchBy pinaldaveFirst article on topic - SQL SERVER - 2008 - Creating Full Text Catalog and Full Text Search |
SQL, Windows, SQL Server, Architect, DBA, Dev, SysAdmin
|
|
Advanced Search |
|
|
|
||||||||||||||||
Full Text Index helps to perform complex queries against character data. These queries can include word or phrase searching. We can create a full-text index on a table or indexed view in a database. Only one full-text index is allowed per table or indexed view. The index can contain up to 1024 columns. This feature works with RTM (Ready to Manufacture) version of SQL Server 2008 and does not work on CTP (Community Technology Preview) versions.
To create an Index, follow the steps:
Full-Text can also be created while creating a Full-Text Index in its Wizard.
As the Index is created and populated, you can write the query and use it in searching records on that table which provides better performance.
For example, we will find the Employee Records that have "Marking" in their Job Title.
FREETEXT( ) is the predicate used to search columns containing character-based data types. It will not match the exact word, but the meaning of the words in the search condition. When FREETEXT is used, the full-text query engine internally performs the following actions on the freetext_string, assigns each term a weight, and then finds the matches.
CONTAINS( ) is similar to Freetext but with the difference that it takes one keyword to match with the records, and if we want to combine other words as well in the search, then we need to provide the "and" or "or" in the search, else it will throw an error.
USE AdventureWorks2008
GO
SELECT BusinessEntityID, JobTitle
FROM HumanResources.Employee
WHERE FREETEXT(*, 'Marketing Assistant');
SELECT BusinessEntityID,JobTitle
FROM HumanResources.Employee
WHERE CONTAINS(JobTitle, 'Marketing OR Assistant');
SELECT BusinessEntityID,JobTitle
FROM HumanResources.Employee
WHERE CONTAINS(JobTitle, 'Marketing AND Assistant');
GO
Full text indexing is a great feature that solves a database problem, the searching of textual data columns for specific words and phrases in SQL Server databases. Full Text Index can be used to search words, phrases and multiple forms of word or phrase using FREETEXT() and CONTAINS() with "and" or "or" operators.
| You must Sign In to use this message board. | ||||||||
|
||||||||
|
||||||||
|
||||||||
|
||||||||
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 10 Sep 2008 Editor: Deeksha Shenoy |
Copyright 2008 by pinaldave Everything else Copyright © CodeProject, 1999-2009 Web17 | Advertise on the Code Project |