ceiling

Description

Returns the smallest integer greater than or equal to the specified value.

Syntax

ceiling(value)

Parameters

value

is a column, variable, or expression with a datatype is exact numeric, approximate numeric, money, or any type that can be implicitly converted to one of these types.

Examples

Example 1

Returns a value of 124:

select ceiling(123.45)
124 

Example 2

Returns a value of -123:

select ceiling(-123.45)
-123 

Example 3

Returns a value of 24.000000:

select ceiling(1.2345E2)
24.000000

Example 4

Returns a value of -123.000000:

select ceiling(-1.2345E2)
-123.000000

Example 5

Returns a value of 124.00

select ceiling($123.45)
124.00 

Example 6

Returns values of “discount” from the salesdetail table where title_id is the value “PS3333”:

select discount, ceiling(discount) from salesdetail where title_id = "PS3333"
discount                                  
 -------------------- -------------------- 
            45.000000            45.000000 
            46.700000            47.000000 
            46.700000            47.000000 
            50.000000            50.000000 

Usage

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

Any user can execute ceiling.

See also

For general information about mathematical functions, see “Mathematical functions”.

Command set

Functions abs, floor, round, sign