Chris
Chris

Reputation: 7369

SQL Server 2005 Fulltext Search Problem

currently I am trying to get the full text search of the SQL Server 2005 to work.

I've got a table where all string columns are populated in a full text catalog.

Now I want to search within these columns. E.g. a row in the first column contains "Name123", the second column contains "LegalForm123" The second row in the first column contains "Name123 LegalForm123", the second column is empty.

Now when searching for both values it seems that the containstable is not searching across multiple tables.

CONTAINSTABLE(ServiceProvider, (Col1, Col2), 'Name123 AND LegalForm123', 1000) 
-- returns the second row only

CONTAINSTABLE(ServiceProvider, (Col1, Col2), 'Name123 OR LegalForm123', 1000) 
-- returns the both rows

Why is the first example not returning both rows as well? Dosn't it search across all columns?

Upvotes: 1

Views: 192

Answers (1)

Steve Cooper
Steve Cooper

Reputation: 21490

The first code same reads 'find a row where a value matching 'Name123 AND LegalForm123' in either Col1 or Col2'. It's giving the right result.

You probably want

CONTAINSTABLE(ServiceProvider, (Col1, Col2), 'Name123', 1000) 
    or CONTAINSTABLE(ServiceProvider, (Col1, Col2), 'LegalForm123', 1000) 

Upvotes: 0

Related Questions