floor

Description

Returns the largest integer that is less than or equal to the specified value.

Syntax

floor(numeric)

Parameters

numeric

is any exact numeric (numeric, dec, decimal, tinyint, smallint, int, or bigint), approximate numeric (float, real, or double precision), or money column, variable, constant expression, or a combination of these.

Examples

Example 1

select floor(123)
----------- 
        123

Example 2

select floor(123.45)
------- 
    123 

Example 3

select floor(1.2345E2)
-------------------- 
         123.000000

Example 4

select floor(-123.45)
------- 
   -124 

Example 5

select floor(-1.2345E2)
-------------------- 
        -124.000000

Example 6

select floor($123.45)
------------------------ 
                 123.00 

Usage

floor, a mathematical function, returns the largest integer that is less than or equal to the specified value. Results are of the same type as the numeric expression.

For numeric and decimal expressions, the results have a precision equal to that of the expression and a scale of 0.

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

Any user can execute floor.

See also

Documentation Transact-SQL Users Guide

Functions abs, ceiling, round, sign