Поделиться через


SET (Entity SQL)

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 (Entity SQL) 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 (EntityClient).

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

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

The output is shown below:

Value: Adjustable Race
Value: All-Purpose Bike Stand
Value: AWC Logo Cap
Value: BB Ball Bearing
Value: Bearing Ball
...

See Also

Concepts

Entity SQL Reference

Other Resources

Set Operators