http://blog.csdn.net/dxnn520/article/details/8454132
==================================================== "Rounding to take the whole intercept"
Select Round (54.56,0)
==================================================== "Take down the whole intercept"
SELECT Floor (54.56)
==================================================== "Take up the whole intercept"
SELECT CEILING (13.15)
The following transfers are from: http://www.2cto.com/database/201209/156996.html
--mssql the use of the integer function
--Divide two integers to truncate fractional parts
Select 3/4,4/3,5/3
--Results 0,1,1
--Returns the smallest integer greater than or equal to the given number expression
SELECT CEILING (123.55), CEILING (123.45), CEILING ( -123.45), CEILING (0.0)
--Results 124,124,-123,0
--Www.2cto.com
--Rounding round (A, A, b)--result A is accurate to the right of the decimal point, or to the left B bit
Select Round (54.36,-2), round (54.36,-1), round (54.36,0), round (54.36,1), round (54.36,2)
--Results 100.00,50.00,54.00,54.40,54.36
---rounded and converted to integers
Select CAST (Round (56.361,0) as int), CAST (round (56.561,0) as int)
--Results 56,57
--Using For example
---two integers to divide the fractional part (all forward bits)
DECLARE @dividend decimal (20,2), @divisor decimal (20,2)
Set @dividend =3
Set @divisor =4
Select CEILING (@dividend/@divisor)
--Results 1
Set @dividend =4
Set @divisor =3
Select CEILING (@dividend/@divisor)
--Results 2
Set @dividend =5
Set @divisor =3
Select CEILING (@dividend/@divisor)
--Results 2
---two integers rounded up to an integer
Set @dividend =3
Set @divisor =4
Select CAST (Round (@dividend/@divisor, 0) as int)
--Results 1
Set @dividend =4
Set @divisor =3
Select CAST (Round (@dividend/@divisor, 0) as int)
--Results 1
Set @dividend =5
Set @divisor =3
Select CAST (Round (@dividend/@divisor, 0) as int)
--Results 2
==================================================== "Rounding to take the whole intercept"
Select Round (54.56,0)
==================================================== "Take down the whole intercept"
SELECT Floor (54.56)
==================================================== "Take up the whole intercept"
SELECT CEILING (13.15)
An instance of an up-down, rounded-down, rounding-up in SQL Server!