Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Tips Database Forum

» Database Journal Home
» Database Articles
» Database Tutorials
MS Access
SQL Scripts & Samples
» Database Forum
» Slideshows
» Sitemap
Free Newsletters:

By submitting your information, you agree that databasejournal.com may send you databasejournal offers via email, phone and text message, as well as email offers about other products and services that databasejournal believes may be of interest to you. databasejournal will process your information in accordance with the Quinstreet Privacy Policy.

News Via RSS Feed

Database Journal |DBA Support |SQLCourse |SQLCourse2

Featured Database Articles

SQL Scripts & Samples

Posted Jul 16, 2002

Implementing Full Text Search with T-SQL Stored Procedures

By Eli Leiba

Enabling Full Text search in T-SQL is usually neither as "popular" nor as easy as doing it with the Enterprise Manager, but it can be done. (For more information on full text search in SQL Server, see our article from Alexander Chigrik, Setting Up Full-text Search: A Step-by-step Guide.) Here are the steps you'll need to take in order to implement FTS in T-SQL:

--1  Enabling Full Text on the Database

EXEC sp_fulltext_database  'enable'

--2  Create the Catalog (if does not exist)

EXEC sp_fulltext_catalog   'MyCatalog','create'

--3  Add a Full Text Index on a Table

EXEC sp_fulltext_table     'Products', 'create', 'MyCatalog', 'pk_products'
EXEC sp_fulltext_table     'Categories', 'create', 'MyCatalog', 'pk_categories'

--4  Add a Column to the Full Text Index

EXEC sp_fulltext_column    'Products', 'ProductName', 'add'
EXEC sp_fulltext_column    'Categories', 'Description', 'add'

--5  Activate the Index

EXEC sp_fulltext_table     'Products','activate'
EXEC sp_fulltext_table     'Categories','activate'

--6  Start Full Population

EXEC sp_fulltext_catalog   'MyCatalog', 'start_full'

-- Usage in T-SQL (CONTAINS and FREETEXT Predicates)
-- Using the Index in T-SQL

USE Northwind
SELECT ProductId, ProductName, UnitPrice
FROM Products
                ProductName, ' "sasquatch " OR "stout" '

USE Northwind
SELECT CategoryName
FROM Categories
           Description, 'sweetest candy bread and dry meat'

» See All Articles by Columnist Eli Leiba

SQL Scripts & Samples Archives

Comment and Contribute


(Maximum characters: 1200). You have characters left.



Latest Forum Threads
SQL Scripts & Samples Forum
Topic By Replies Updated
sql help!! add 1 August 22nd, 11:58 AM
How To Combine These 2 Queries into 1 Query ? tarek_land 1 June 7th, 08:37 AM
solving query svibuk 1 February 3rd, 06:08 AM
converting from a character string to uniqueidentifier saturnius 4 January 4th, 05:56 AM