Udostępnij za pośrednictwem


COLLECTION (Entity SQL)

The COLLECTION keyword is only used in the definition of an inline function. Collection functions are functions that operate on a collection of values and produce a scalar output.

COLLECTION(type_definition) 

Arguments

  • type_definition
    An expression that returns a collection of supported types, rows, or references.

Remarks

For more information about the COLLECTION keyword, see Type Definitions.

Example

The following sample shows how to use the COLLECTION keyword to declare a collection of decimals as an argument for an inline query function.

USING Microsoft.Samples.Entity
Function MyAvg(dues Collection(Decimal)) AS
(
        Avg(select value due from dues as due where due > @price)
)
SELECT TOP(10) contactID, MyAvg(GroupPartition(order.TotalDue)) 
FROM AdventureWorksEntities.SalesOrderHeaders  AS order 
GROUP BY order.Contact.ContactID as contactID;

See Also

Concepts

Entity SQL Reference