Partager via


Math Canonical Functions (Entity SQL)

Entity SQL includes math canonical functions.

The following table shows the math Entity SQL canonical functions.

Function Description

Abs( value )

Returns the absolute value of value.

Arguments

An Int16, Int32, Int64, Byte, Single, Double, and Decimal.

Return Value

The type of value.

Example

Abs(-2)

Ceiling ( value )

Returns the smallest integer that is not less than value.

Arguments

A Single, Double, and Decimal.

Return Value

The type of value.

Example

SELECT VALUE product FROM AdventureWorksEntities.Product AS product

WHERE CEILING(product.ListPrice) == FLOOR(product.ListPrice)

Floor ( value )

Returns the largest integer that is not greater than value.

Arguments

A Single, Double, and Decimal.

Return Value

The type of value.

Example

SELECT VALUE product FROM AdventureWorksEntities.Product AS product

WHERE CEILING(product.ListPrice) == FLOOR(product.ListPrice)

Round( value )

Returns the integer portion of value, rounded to the nearest integer.

Arguments

A Single, Double, and Decimal.

Return Value

The type of value.

Example

Round(748.58)

These functions will return Null if given Null input.

Equivalent functionality is available in the Microsoft SQL Client Managed Provider. For more information, see .NET Framework Data Provider for SQL Server (SqlClient) for the Entity Framework Functions.

See Also

Concepts

Canonical Functions (Entity SQL)