Open In App

FLOOR() and CEILING() Function in SQL Server

Improve
Improve
Like Article
Like
Save
Share
Report

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

Last Updated : 29 Sep, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads