Monday, 14 November 2016

SQL SERVER CEILING FORMULA

SQL SERVER CEILING FORMULA

--alright viewers, today we will be looking at the Ceiling function in SQL SERVER SSMS

--the ceiling function works a bit like the round function but is different.

--the ceiling function takes any number with decimal places and rounds it up to the next higher value.

--it doesn't matter if the value is below 5 or not.

--I will now demonstrate

select CEILING(101.0000001);

--let us look at this again using listprice in the product table

select CEILING(P.ListPrice) as [Ceiling Function], ListPrice
from AdventureWorksDW2012.dbo.DimProduct as P;

--you can see from the comparison of the ceiling function values and the normal values that

--no matter what the decimal value is the numbers have been rounded up to the next higher whole value

--despite if the decimal value is >= 5 or not.

--that is it.

No comments:

Post a Comment