Extracts an element from a multivalued collection.
ANYELEMENT ( expression )
Any valid query expression that returns a collection to extract an element from.
A single element in the collection or an arbitrary element if the collection has more than one; if the collection is empty, returns
collectionis a collection of type
ANYELEMENT(collection) is a valid expression that yields an instance of type
ANYELEMENT extracts an arbitrary element from a multivalued collection. For example, the following example attempts to extract a singleton element from the set
The following Entity SQL query uses the ANYELEMENT operator to extract an element from a multivalued collection. The query is based on the AdventureWorks Sales Model. To compile and run this query, follow these steps:
Follow the procedure in How to: Execute a Query that Returns StructuralType Results.
Pass the following query as an argument to the
ANYELEMENT((SELECT VALUE product from AdventureWorksEntities.Products as product where product.ListPrice = @price))