ABS
Description
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.) (ABS in Transact-SQL).
Sample Source Pattern
Syntax
Examples
Code:
SELECT ABS(-5);Result:
ABS(-5)|
-------+
5|Code:
SELECT ABS(-5);Result:
ABS(-5)|
-------+
5|Code:
CREATE OR REPLACE FUNCTION compute_abs(a float)
RETURNS float
LANGUAGE JAVASCRIPT
AS
$$
return Math.abs(A);
$$
;
SELECT COMPUTE_ABS(-5);Result:
COMPUTE_ABS(-5)|
---------------+
5|Related Documentation
Last updated