CEILING function in SQL Server

The CEILING function in SQL Server returns the smallest integer value greater than or equal to the transmitted numeric expression.

This article will show you in detail how to use the SQL Server CEILING () function with the syntax and specific examples to make it easier to visualize and capture functions.

Describe

The CEILING function in SQL Server returns the upper bound value of the number or expression, ie returns the smallest integer value but greater than or equal to the transmitted numeric expression.

Syntax

To use the CEILING function in SQL Server, we use the following syntax:

 CEILING(number) 

Parameters :

  1. number: the number passed to find the smallest integer value.

Note :

  1. See also FLOOR and ROUND functions.
  2. The CEILING function can be used in later versions of SQL Server: SQL Server 2017, SQL Server 2016, SQL Server 2014, SQL Server 2012, SQL Server 2008 R2, SQL Server 2008, and SQL Server 2005.

For example

See and explore some examples of CEILING functions in SQL Server.

 SELECT CEILING(32.65); 
Result: 33

SELECT CEILING(32.1);
Result: 33

SELECT CEILING(32);
Result: 32

SELECT CEILING(-32.65);
Result: -32

SELECT CEILING(-32);
Result: -32

Previous article: Function AVG in SQL Server

Next lesson: COUNT function in SQL Server

4.3 ★ | 4 Vote