SQL Server: CEILING Function

 CEILING function in SQL Server

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 functions returns the smallest integer value that is greater than or equal to a number.

Syntax

The syntax for the CEILING function in SQL Servers (Transact-SQL) is:

CEILING( number )

Parameters or Arguments

numberThe number used to find the smallest integer value.

Note

Applies To

The CEILING functions 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 functions in SQL Servers (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

This Post Has One Comment

Leave a Reply