Logo 
Search:

SQL Server Articles

Submit Article
Home » Articles » SQL Server » Rowset Functions RSS Feeds

FREETEXTTABLE Function

Posted By: Sarita Patel     Category: SQL Server     Views: 6796

This article explains about FREETEXTTABLE function in sql server with examples.

FREETEXTTABLE function returns a table of zero, one, or more rows for those columns containing character-based data types for values that match the meaning, but not the exact wording, of the text in the specified freetext_string. FREETEXTTABLE can be referenced in the FROM clause of a SELECT statement like a regular table name.



Syntax of FREETEXTTABLE Function :


FREETEXTTABLE (table , { column | * } , 'freetext_string' [ ,top_n_by_rank ] )

table is a name of table that has been marked for full-text querying.

column is a name of column to search. Column of type character string are valid full-text searching columns.

* Specifies that all columns in the table that have been registered for full-text searching should be used to search for the given freetext_string.

freetext_string is a text to search for in the specified column.

top_n_by_rank specifies that only top n matches are returned. 




Examples of FREETEXTTABLE Function :

Example 1 : Use of FREETEXTTABLE function in select clause

SELECT Cust.ContactName, Cust.CompanyName, KEY_TBL.RANK
FROM   Customers Cust 
INNER JOIN FREETEXTTABLE(Customers, ContactName, 'maria ann hanna victoria') AS KEY_TBL
ON Cust.CustomerID = KEY_TBL.[KEY]
ORDER BY RANK

Output
ContactName            CompanyName                RANK
Maria Anders            Alfreds Futterkiste            18
Maria Larsson           Folk och fä HB                  18
Hanna Moos             Blauer See Delikatessen     21
Victoria Ashworth     B's Beverages                   21
Ann Devon               Eastern Connection           21

Above example returns all customers having contact name from the specified text 'maria ann hanna victoria'.
  
Share: 

 
 

Didn't find what you were looking for? Find more on FREETEXTTABLE Function Or get search suggestion and latest updates.

Sarita Patel
Sarita Patel author of FREETEXTTABLE Function is from United States.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!