totn SQL Server Functions

SQL Server: FLOOR Function

This SQL Server tutorial explains how to use the FLOOR function in SQL Server (Transact-SQL) with syntax and examples.

Description

In SQL Server (Transact-SQL), the FLOOR function returns the largest integer value that is equal to or less than a number.

Syntax

The syntax for the FLOOR function in SQL Server (Transact-SQL) is:

FLOOR( number )

Parameters or Arguments

number
The value used to determine the largest integer value that is equal to or less than a number.

Note

Applies To

The FLOOR 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 FLOOR function examples and explore how to use the FLOOR function in SQL Server (Transact-SQL).

For example:

SELECT FLOOR(5.9);
Result: 5

SELECT FLOOR(34.29);
Result: 34

SELECT FLOOR(-5.9);
Result: -6