ABS
A mathematical function that returns the absolute (positive) value of the specified numeric expression. ABS changes negative values to positive values. ABS has no effect on zero or positive values.
Syntax
ABS ( numeric_expression )
Arguments
numeric_expression
Is an expression of the exact numeric or approximate numeric data type category.
Return types
Returns the same type as numeric_expression, excluding types described below:
input type | output type |
---|---|
smallmoney | money |
bit | float |
real | float |
smallint | int |
tinyint | int |
Example
SELECT ABS(1.01e0);