FIX: Full-Text Search Queries with CONTAINS Clause Search Across Columns (294809)
The information in this article applies to:
- Microsoft SQL Server 7.0
- Microsoft SQL Server 7.0 Service Pack 1
- Microsoft SQL Server 7.0 Service Pack 2
This article was previously published under Q294809 SYMPTOMS
If there are two or more different full-text search enabled columns on a table, and if the keywords separated by the AND operator exist in two different columns, a CONTAINS predicate with the AND operator searches for the keywords across all columns.
For example, assume a table called ftstable with three columns: c1 as integer (the index column), and c2 and c3 as varchar columns that are full-text enabled. Also assume that a row contains "apples" in column c2 and "oranges" in columnn c3. In SQL Server 7.0 SP2 and earlier, the following query
select c1 from ftstable where contains(*,'"apples" and "oranges"')
is incorrectly interpreted as follows:
select c1 from ftstable where contains(*,'"apples"') AND contains(*,'"oranges"')
and the row is returned. NOTE: The correct way to interpret the query is as follows:
select c1 from ftstable where contains(c2,'"apples" and "oranges"') OR contains(c3,'"apples" and "oranges"')
and to not return the row.
RESOLUTION
You can work around this problem in the following ways:
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was first corrected in SQL Server 7.0 Service Pack 3.
Modification Type: | Minor | Last Reviewed: | 7/16/2004 |
---|
Keywords: | kbbug kbfix KB294809 |
---|
|