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.

Table of Contents

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

You've just finished reading the article "FLOOR function in SQL Server" edited by the TipsMake team. You can save floor-function-in-sql-server.pdf to your computer here to read later or print it out. We hope this article has provided you with many useful tech tips and tricks. You can search for similar articles on tips and guides. Thank you for reading and for following us regularly.

« PREV : COUNT function in...
CEILING function in... : NEXT »