FLATTEN (Entity SQL)

Converts a collection of collections into a flattened collection. The new collection contains all the same elements as the old collection, but without a nested structure.

Syntax

FLATTEN ( collection )

Arguments

collection Any valid expression that returns a collection of value collections to flatten into a single collection.

Remarks

FLATTEN 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 FLATTEN operator to convert a collection of collections into a flattened collection. 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:

FLATTEN(SELECT VALUE c.SalesOrderHeaders From 
    AdventureWorksEntities.Contacts AS c)

See also