FLOOR function in SQL Server

The FLOOR function in SQL Server returns the largest integer value but less than or equal to the transmitted numeric expression.

This article will show you in detail how to use the FLOOR () numerical processing function in SQL Server with specific syntax and examples to better visualize and capture functions.

Describe

The FLOOR function in SQL Server returns the lower bound value of the number or expression, ie returns the largest integer value but less than or equal to the transmitted numeric expression.

Syntax

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

 FLOOR(number) 

Parameters :

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

Note :

  1. See more CEILING and ROUND functions.
  2. The FLOOR 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

Take a look and explore some examples of FLOOR functions in SQL Server.

 SELECT FLOOR(5.9); 
Result: 5

SELECT FLOOR(5);
Result: 5

SELECT FLOOR(34.29);
Result: 34

SELECT FLOOR(-5.9);
Result: -6

SELECT FLOOR(-5);
Result: -5

Previous article: COUNT function in SQL Server

Next lesson: MAX function in SQL Server

4 ★ | 1 Vote