MULTISET (Entity SQL)

 

Creates an instance of a multiset from a list of values. All the values in the MULTISET constructor must be of a compatible type T. Empty multiset constructors are not allowed.

  
MULTISET ( expression [{, expression }] )  
or  
{ expression [{, expression }] }  

expression
Any valid list of values.

A collection of type MULTISET<T>.

Entity SQL provides three kinds of constructors: row constructors, object constructors, and multiset (or collection) constructors. For more information, see Constructing Types.

The multiset constructor creates an instance of a multiset from a list of values. All the values in the constructor must be of a compatible type.

For example, the following expression creates a multiset of integers.

MULTISET(1, 2, 3)

{1, 2, 3}

System_CAPS_ICON_note.jpg Note

Nested multiset literals are only supported when a wrapping mutiset has a single multiset element; for example, {{1, 2, 3}}. When the wrapping multiset has multiple multiset elements (for example, {{1, 2}, {3, 4}}), nested multiset literals are not supported.

The following Entity SQL query uses the MULTISET operator to create an instance of a multiset from a list of values. 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#MULTISET](../CodeSnippet/VS_Snippets_Data/dp entityservices concepts 2#multiset)]

Constructing Types
Entity SQL Reference

Show: