Home » SQL Server FLOOR Function

SQL Server FLOOR Function

SQL Server FLOOR Function is a mathematical function that returns the largest integer value that is less than or equal to a number.





SYNTAX

FLOOR ( numeric_expression )

numeric_expression
Is a numeric input value or approximate numeric data type category.

Lets look at an example of FLOOR() function in SQL Server.

FLOOR function with positive values

For input value 100.01

 SELECT FLOOR(100.01) AS OUTPUT

 

 

 

 

 

It returns 100, which is a largest integer value that is less than input value 100.01.

 

For input value 155.61

 SELECT FLOOR(155.61) AS OUTPUT

 

 

 

 

 

It returns 155, which is a largest integer value that is less than input value 155.61.

For input value 00.50

SELECT FLOOR(00.50) AS OUTPUT

 

 

 

 

 

It returns 0, which is a largest integer value that is less than input value 00.50.

For input value 568.01

SELECT FLOOR(568.01) AS OUTPUT

 

 

 

 

 

It returns 568, which is a largest integer value that is less than input value 568.01.

 

FLOOR function with positve values 

For Negative input value -00.01

SELECT FLOOR(-00.01) AS OUTPUT

It returns -1, which is a largest integer value that is less than input value -00.01.

 

For Negative input value -555.12

SELECT FLOOR(-555.12) AS OUTPUT

It returns -556, which is a largest integer value that is less than input value -555.12.

 

For Negative input value -568.01

SELECT FLOOR(-568.01) AS OUTPUT

It returns -569, which is a largest integer value that is less than input value -568.01.

 

Also Read..

CEILING()

SQL Basics TutorialSQL Advance TutorialSSRSInterview Q & A
SQL Create tableSQL Server Stored ProcedureCreate a New SSRS Project List Of SQL Server basics to Advance Level Interview Q & A
SQL ALTER TABLESQL Server MergeCreate a Shared Data Source in SSRSSQL Server Question & Answer Quiz
SQL DropSQL Server PivotCreate a SSRS Tabular Report / Detail Report
..... More.... More....More
Power BI TutorialAzure TutorialPython TutorialSQL Server Tips & Tricks
Download and Install Power BI DesktopCreate an Azure storage accountLearn Python & ML Step by stepEnable Dark theme in SQL Server Management studio
Connect Power BI to SQL ServerUpload files to Azure storage containerSQL Server Template Explorer
Create Report ToolTip Pages in Power BICreate Azure SQL Database ServerDisplaying line numbers in Query Editor Window
....More....More....More




 421 total views,  1 views today

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.