Export (0) Print
Expand All

IN

SQL Server 2000

Determines whether a given value matches any value in a subquery or a list.

Syntax
test_expression [ NOT ] IN 
   ( 
 subquery 
 | expression [ ,...n ] 
   ) 
Arguments
test_expression
Is any valid expression in Microsoft® SQL Server™ 2000 Windows® CE Edition (SQL Server CE).
subquery
Is a subquery that has a result set of one column. This column must have the same data type as test_expression.
expression [,...n]
Is a list of expressions to test for a match. All expressions must be of the same type as test_expression.
Result Types

bit

Result Value

If the value of test_expression is equal to any value returned by subquery or is equal to any expression from the comma-separated list, the result value is TRUE. Otherwise, the result value is FALSE.

Using NOT IN negates the returned value.

Examples

The following example selects all customers in the Northwind database who are from Brazil, Argentina, and Venezuela.

SELECT * FROM Customers WHERE Country IN ('Brazil', 'Argentina', 'Venezuela')

Show:
© 2014 Microsoft