Logo

ROUNDUP

Updated 2023-10-20 15:33:23.100000

Syntax

SELECT [westclintech].[wct].[ROUNDUP] (
   <@Number, float,>
 ,<@Num_digits, float,>)

Description

Use the scalar function ROUNDUP to calculate a number rounded up, away from zero.

Arguments

@Num_digits

is the number of digits to be rounded up to. @Num_digits is an expression of type float or of a type that can be implicitly converted to float.

@Number

is the number to rounded up. @Number is an expression of type float or of a type that can be implicitly converted to float.

Return Type

float

Remarks

ROUNDUP behaves like the ROUND function, except that it always rounds @Number up, away from zero.

If @Num_digits is greater than 0 (zero), then number is rounded up to the specified number of decimal places.

If @Num_digits is 0, then number is rounded up to the nearest integer.

If @Num_digits is less than 0, then number is rounded up to the left of the decimal point.

Rounding up means away from zero.

Examples

SELECT wct.ROUNDUP(cast(2.0000 as float) / cast(3.0000 as float), 5);

Here is the result set.

{"columns":[{"field":"column 1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"column 1":"0.66667"}]}