A union of curiosity and data science

Knowledgebase and brain dump of a database engineer


Excel Floor Function in SQL Server

 

In Excel, the FLOOR function returns a number rounded down based on a multiple of significance.
The syntax for the
FLOOR function is:

FLOOR( number, significance )

number is the number that you wish to round down.

significance is the multiple of significance that you wish to round a number to.

 

 

create function floor(@number decimal(16, 2)

,
@significance decimal (16, 2))


returns
decimal(16,2)

as

begin

       return   @number - (@number % @significance)

end

go

 
 
 
 
 

Add comment