SQL Flow Field Guide

ABS

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

math

What changes

Input
numeric arguments
Output or change
numeric value
Return type
The return type depends on the input type of numeric_expression: Input type Return type float, real float decimal(p, s) decimal(38, s) int, smallint, tinyint int bigint bigint money, smallmoney money

Syntax at a glance

ABS ( numeric_expression )

Work example

Compare the magnitude of signed differences without changing the source value.

Use a type wide enough for the positive result, especially for the smallest signed integer.

Check your work ABS can overflow when a signed integer's minimum value has no positive counterpart in that type.

Practice SQL

Open in SQL Flow
SELECT ABS(-17) AS magnitude;

Open Microsoft Learn for full syntax, permissions, and details for your version.