WHERE Clause

The WHERE clause specifies which rows in the virtual table defined by the FROM clause make up the resulting rowset. The WHERE clause requires a search condition (that is, one or more predicates combined with AND, OR and NOT) that filters out rows for which the search condition is false.

High-Level Syntax

WHERE Search_Conditions

Search_Conditions is composed of one or more predicates combined with AND, OR, and NOT. It specifies the conditions that rows must satisfy to belong to the resulting rowset. The rowset only includes rows in which all the predicates evaluate to TRUE.

Precedence Rules

When the search condition consists of statements enclosed in parentheses, expressions in parentheses are evaluated first. After the parenthetical expressions are evaluated, the following rules apply:

Note:

It is illegal to place NOT before content query predicates (CONTAINS and FREETEXT). The following statement is illegal:
SELECT FileName FROM SCOPE() WHERE NOT CONTAINS ('search')>0

The following statement is legal:

SELECT FileName FROM SCOPE() WHERE CONTAINS ('search')>0 AND NOT CONTAINS ('foo')>0

Predicates

A predicate is an expression that asserts a fact about values.

For more information about the predicates you can use with the WHERE clause, see:


© 1997 by Microsoft Corporation. All rights reserved.