Icon ABS

Converts an interval to its absolute value.

Syntax
ABS(<IntervalExpression>)

<IntervalExpression> =

Type of:

INTERVAL YEAR [TO MONTH]
INTERVAL MONTH
INTERVAL DAY [TO HOUR|MINUTE|SECOND|MSECOND]
INTERVAL HOUR [TO MINUTE|SECOND|MSECOND]
INTERVAL MINUTE [TO SECOND|MSECOND]
INTERVAL SECOND [TO MSECOND]
INTERVAL MSECOND

Returns
Same as Input

Usage
The ABS function converts an interval value to its absolute, or non-negative value.

Examples
SELECT ABS(StartDate - EndDate) AS NumDays
FROM Reservations

SQL 2003 Standard Deviations
This function deviates from the SQL 2003 standard in the following ways:

DeviationDetails
None
Image