CEILING Function

Returns the smallest integer greater than or equal to a specified numeric expression.

Syntax

CEILING ( numeric_expression )

Arguments

Argument Description Data Types
numeric_expression The expression of a precise or imprecise numeric data type that is to be evaluated. All categories of numeric data types.

Return Types

Returns one of the numeric data types of input argument.

Examples

Example 1: Basic Usage

This example demonstrates the basic usage of the CEILING function.

SELECT CEILING(123.456);

Result:

124

Example 2: Negative Numbers

This example shows how CEILING works with negative numbers.

SELECT CEILING(-123.456);

Result:

-123

Example 3: Using with a Table Column

This example uses CEILING with a column from a hypothetical table.

-- Assuming a table named 'Products' with a 'Price' column SELECT ProductName, Price, CEILING(Price) AS RoundedUpPrice FROM Products WHERE ProductID = 1;

If Price for ProductID = 1 is 49.99, the result would be:

ProductName | Price | RoundedUpPrice ----------|-------|---------------- Gadget | 49.99 | 50

Remarks

See Also