SQL Server CEILING Function is a mathematical function that returns the smallest integer value that is greater than or equal to a number.
SYNTAX
CEILING ( numeric_expression )
numeric_expression
Is a numeric input value or approximate numeric data type category.
Lets look at an example of CEILING() function in SQL Server.
CEILING function with positive values
For input value 100.00
SELECT CEILING(100.00) AS OUTPUT
It returns a smallest integer value 100 that is grater than or equal to input value 100.
For input value 100.01
SELECT CEILING(100.01) AS OUTPUT
It returns a value 101, which is a smallest integer value that is greater than input value 100.01.
For input value 560.56
SELECT CEILING(560.56) AS OUTPUT
It returns a value 561, which is a smallest integer value that is greater than input value 560.56.
CEILING function with Negative valuesย
For negative input value -560.56
SELECT CEILING(-560.56) AS OUTPUT
It returns a value -560, which is a smallest integer value that is greater than input value -560.56.
For negative input value -00.16
SELECT CEILING(-00.16) AS OUTPUT
It returns a value -0, which is a smallest integer value that is greater than input value -00.16.
For negative input value -100.00
SELECT CEILING(-100.00) AS OUTPUT
It returns a value -100, which is a smallest integer value that is greater than input value -100.00.
Also Readd..
1,226 total views, 1 views today