Sunday, February 26, 2012

Full-Text Setup and Search

Hi,

I have a database developed using SQL Server Management Studio Express with Full-Text searching. I can go into the Object Explorer and right click on my database and choose Properties, select File and the 'Use-full-ext indexing' is checked.

I'm not sure how I create an index for a table, can someone help? I want to create an index for table 'tblLogNotes' and have the following columns:

note_id = (PK, int, not null)
note = (varchar(3000), not null)
log_id = (FK, int, not null)
operatorid = (int, not null)
note_created = (datetime, not null)

I know I did something but not sure what I did, but on one of my tables, when I right click on table and choose 'log_note', I can see that Full-text Specification = yes, (is full-text indexed = yes), full-text type column = <none> and language = English (United States).

Table 'tblLog' has the following columns:
log_id - (PK, int - not null)
log_note (varchar(3000), not null)
tag_number(varchar(50), not null)

However, when I try the following query, I get nothing:

SELECT *
FROM tblLog
WHERE CONTAINS(Log_note, '"pump*"')

I've also tried: 'pump'

What am I doing wrong?

Thanks,

Hi Ed,

You need to create a Full Text Catalog and a Full Text Index before you can query against them. See...

CREATE FULLTEXT CATALOG

CREATE FULLTEXT INDEX

and

The Full Text Overview topic in Books Online.

SSMSE does not enable the Full Text commands for technical reasons, but you can use the Template Explorer to get the basic SQL statements and then just fill in the blanks for your database.

Mike

No comments:

Post a Comment