SQL Server: ABS Function

This SQL Server tutorial explains how to use the ABS function in SQL Server (Transact-SQL) with syntax and examples.


In SQL Server (Transact-SQL), the ABS function returns the absolute value of a number.


The syntax for the ABS function in SQL Server (Transact-SQL) is:

ABS( number )

Parameters or Arguments

The number to convert to an absolute value.

Applies To

The ABS function can be used in the following versions of SQL Server (Transact-SQL):

  • SQL Server 2017, SQL Server 2016, SQL Server 2014, SQL Server 2012, SQL Server 2008 R2, SQL Server 2008, SQL Server 2005


Let’s look at some SQL Server ABS function examples and explore how to use the ABS function in SQL Server (Transact-SQL).

For example:

Result: 24

SELECT ABS(-24.6);
Result: 24.6

SELECT ABS(-24.65);
Result: 24.65

SELECT ABS(24.65 * -1);
Result: 24.65