Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
ABS

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 categories, or types that are implicitly convertible to float.
Return Types

Returns the same type as numeric_expression except for the following expressions.

Specified expression Return type
tinyint, smallint int
real/float float
Nonnumeric types that can be implicitly converted to float float
Examples

The following example returns the absolute value of the difference between the units of products in stock and units of products that have been ordered in the Products table of the Northwind database.

SELECT (UnitsInStock - UnitsOnOrder), ABS(UnitsInStock - UnitsOnOrder)
FROM Products

Show:
© 2015 Microsoft