SQL Server: CEILING Function
This SQL Server tutorial explains how to use the CEILING function in SQL Server (Transact-SQL) with syntax and examples.
Description
In SQL Server (Transact-SQL), the CEILING function returns the smallest integer value that is greater than or equal to a number.
Syntax
The syntax for the CEILING function in SQL Server (Transact-SQL) is:
CEILING( number )
Parameters or Arguments
- number
- The number used to find the smallest integer value.
Applies To
The CEILING function can be used in the following versions of SQL Server (Transact-SQL):
- SQL Server 2017, SQL Server 2016, SQL Server 2014, SQL Server 2012, SQL Server 2008 R2, SQL Server 2008, SQL Server 2005
Example
Let’s look at some SQL Server CEILING function examples and explore how to use the CEILING function in SQL Server (Transact-SQL).
For example:
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