Export (0) Print
Expand All
ABS
ALL
AND
ANY
AVG
bit
COS
COT
DAY
EXP
GO
IN
LEN
LOG
MAX
MIN
NOT
OR
PI
SET
SIN
STR
SUM
TAN
USE
VAR
Expand Minimize

ABS

SQL Server 2000

Returns the absolute, positive value of the given numeric expression.

Syntax

ABS ( numeric_expression )

Arguments

numeric_expression

Is an expression of the exact numeric or approximate numeric data type category, except for the bit data type.

Return Types

Returns the same type as numeric_expression.

Examples

This example shows the effect of the ABS function on three different numbers.

SELECT ABS(-1.0), ABS(0.0), ABS(1.0)

Here is the result set:

---- ---- ----
1.0  .0   1.0

The ABS function can produce an overflow error, for example:

SELECT ABS(convert(int, -2147483648))

Here is the error message:

Server: Msg 8115, Level 16, State 2
Arithmetic overflow error converting expression to type int.

See Also

CAST and CONVERT

Data Types

Mathematical Functions

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft