Skip to content
Related Articles

Related Articles

FLOOR() and CEILING() Function in SQL Server
  • Last Updated : 29 Sep, 2020

1. FLOOR() Function :
The FLOOR() function returns the largest integer value which is less than or equal to a number.

Syntax :

FLOOR(number)

Parameter : Required. A numeric value.
number : It is a numeric value.
Returns : It returns the integer value.

Example-1 :
When the argument holds a positive number.

SELECT FLOOR(21.53);

Output :



21



Example-2 :
When the argument holds a negative number.

SELECT FLOOR(-21.53);

Output :

-22


2. CEILING() Function :
The CEILING() function returns the smallest integer value which is greater than or equal to a number.

Syntax :

CEILING(number)

Parameter : Required. A numeric value.
number : It is a numeric value.
Returns : It returns the integer value.

Example-1 :
When the argument holds a positive number.

SELECT CEILING(21.53);

Output :

22



Example-2 :
When the argument holds a negative number.

SELECT CEILING(-21.53);

Output :

-21
My Personal Notes arrow_drop_up
Recommended Articles
Page :