Sdílet prostřednictvím


SET

The SET expression is used to convert a collection of objects into a set by yielding a new collection with all duplicate elements removed.

SET ( expression )

Arguments

  • expression
    Any valid query expression that returns a collection.

Remarks

The set expression SET(c) is logically equivalent to the following select statement:

SELECT VALUE DISTINCT c FROM c

SET is one of the Entity SQL set operators. All Entity SQL set operators are evaluated from left to right. See EXCEPT for precedence information for the Entity SQL set operators.

Example

The following Entity SQL query uses the SET expression to convert a collection of objects into a set. 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 PrimitiveType Results.

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

SET(SELECT VALUE P.Name FROM AdventureWorksEntities.Products AS P)

See Also

Concepts

Entity SQL Reference