[NOT] IN (TSQL Operator)
Checks if an expression is equal to any of the values in the specified list.
Syntax
expression [ NOT ] IN ( expr_1, [, ...expr_n] )
Arguments
- expression
- is an expression of any type.
- expr_1, … expr_n
- is a list of expressions of any type.
Return Types
Returns a result of type bool.
Remarks
If expression and expr_n are varchar, the comparison is affected by the collation.
NOT IN returns the negated result of IN.
Examples
PRINT 4 IN (1, 4, 10, 30);
PRINT 5 IN (1, 4, 10, 30);
PRINT NULL IN (1, 4, 10, 30);
The result is:
true
false
<NULL>