IN (Entity SQL)

 

Determines whether a value matches any value in a collection.

  
value [ NOT ] IN expression  

value
Any valid expression that returns the value to match.

[ NOT ]
Specifies that the Boolean result of IN be negated.

expression
Any valid expression that returns the collection to test for a match. All expressions must be of the same type or of a common base or derived type as value.

true if the value is found in the collection; null if the value is null or the collection is null; otherwise, false. Using NOT IN negates the results of IN.

The following Entity SQL query uses the IN operator to determine whether a value matches any value in a collection. The query is based on the AdventureWorks Sales Model. To compile and run this query, follow these steps:

  1. Follow the procedure in How to: Execute a Query that Returns StructuralType Results.

  2. Pass the following query as an argument to the ExecuteStructuralTypeQuery method:

[!CODE [DP EntityServices Concepts 2#IN](../CodeSnippet/VS_Snippets_Data/dp entityservices concepts 2#in)]

Entity SQL Reference

Show: