CEILING and FLOOR functions |
||||||||||||||||||||||||||||||
CEILING functionCEILING function returns the smallest integer greater than, or equal to, the specified numeric expression. The following query
The result returned by the function is of the same data type as that of an argument. But the example been considered wouldn't seem to confirm what was said above. Moreover, even doing explicit conversion of data type of the argument to exact numeric, we get integers (in Management Studio) except the money constant:
When using other client applications/drivers, you could get quite another representation of the result. If you execute this query in the tutorial directly, what result are you obtaining? It may be said that format of result is just only "circumstantial evidence" for conclusion about result data type. More reliable approach is bytes occupied in memory by a value.
The result of CEILING function has the same size in memory as the argument has, but the result been converted to the integer data type occupies 4 bytes only. FLOOR functionThe FLOOR function, on the contrary, returns the largest integer less than or equal to the specified numeric expression.
|