- <search_condition>
Specifies the conditions for the rows returned in the result set for a SELECT statement, query expression, or subquery. For an UPDATE statement, specifies the rows to be updated. For a DELETE statement, specifies the rows to be deleted. There is no limit to the number of predicates that can be included in a Transact-SQL statement search condition.
- NOT
Negates the Boolean expression specified by the predicate. For more information, see NOT (Transact-SQL).
- AND
Combines two conditions and evaluates to TRUE when both of the conditions are TRUE. For more information, see AND (Transact-SQL).
- OR
Combines two conditions and evaluates to TRUE when either condition is TRUE. For more information, see OR (Transact-SQL).
- < predicate >
Is an expression that returns TRUE, FALSE, or UNKNOWN.
- expression
Is a column name, a constant, a function, a variable, a scalar subquery, or any combination of column names, constants, and functions connected by an operator or operators, or a subquery. The expression can also contain the CASE expression.
Note |
|---|
When referencing the Unicode character data types nchar, nvarchar, and ntext, 'expression' should be prefixed with the uppercase letter 'N'. If 'N' is not specified, SQL Server converts the string to the code page that corresponds to the default collation of the database or column. Any characters not found in this code page are lost. |
- =
Is the operator that is used to test the equality between two expressions.
- <>
Is the operator that is used to test the condition of two expressions not being equal to each other.
- !=
Is the operator that is used to test the condition of two expressions not being equal to each other.
- >
Is the operator that is used to test the condition of one expression being greater than the other.
- >=
Is the operator that is used to test the condition of one expression being greater than or equal to the other expression.
- !>
Is the operator that is used to test the condition of one expression not being greater than the other expression.
- <
Is the operator that is used to test the condition of one expression being less than the other.
- <=
Is the operator that is used to test the condition of one expression being less than or equal to the other expression.
- !<
Is the operator that is used to test the condition of one expression not being less than the other expression.
- string_expression
Is a string of characters and wildcard characters.
- [ NOT ] LIKE
Indicates that the subsequent character string that will be used with pattern matching. For more information, see LIKE (Transact-SQL).
- ESCAPE 'escape_ character'
Allows for a wildcard character to be searched for in a character string instead of functioning as a wildcard. escape_character is the character that is put in front of the wildcard character to indicate this special use.
- [ NOT ] BETWEEN
Specifies an inclusive range of values. Use AND to separate the starting and ending values. For more information, see BETWEEN (Transact-SQL).
- IS [ NOT ] NULL
Specifies a search for null values, or for values that are not null, depending on the keywords used. An expression with a bitwise or arithmetic operator evaluates to NULL if any one of the operands is NULL.
- CONTAINS
Searches columns that contain character-based data for precise or less precise (fuzzy) matches to single words and phrases, the proximity of words within a certain distance of one another, and weighted matches. This option can only be used with SELECT statements. For more information, see CONTAINS (Transact-SQL).
- FREETEXT
Provides a simple form of natural language query by searching columns that contain character-based data for values that match the meaning instead of the exact words in the predicate. This option can only be used with SELECT statements. For more information, see FREETEXT (Transact-SQL).
- [ NOT ] IN
Specifies the search for an expression, based on whether the expression is included in or excluded from a list. The search expression can be a constant or a column name, and the list can be a set of constants or, more typically, a subquery. Enclose the list of values in parentheses. For more information, see IN (Transact-SQL).
- subquery
Can be considered a restricted SELECT statement and is similar to <query_expresssion> in the SELECT statement. The ORDER BY clause, the COMPUTE clause, and the INTO keyword are not allowed. For more information, see SELECT (Transact-SQL).
- ALL
Used with a comparison operator and a subquery. Returns TRUE for <predicate> when all values retrieved for the subquery satisfy the comparison operation, or FALSE when not all values satisfy the comparison or when the subquery returns no rows to the outer statement. For more information, see ALL (Transact-SQL).
- { SOME | ANY }
Used with a comparison operator and a subquery. Returns TRUE for <predicate> when any value retrieved for the subquery satisfies the comparison operation, or FALSE when no values in the subquery satisfy the comparison or when the subquery returns no rows to the outer statement. Otherwise, the expression is UNKNOWN. For more information, see SOME | ANY (Transact-SQL).
- EXISTS
Used with a subquery to test for the existence of rows returned by the subquery. For more information, see EXISTS (Transact-SQL).