ABS function in SQL Server

This article will show you in detail how to use the ABS () handling function in SQL Server with specific syntax and examples to better visualize and capture functions.

Describe

The ABS function in SQL Server returns the absolute value of a number.

Syntax

To use the ABS function in SQL Server, we use the following syntax:

 ABS(number) 

Parameters :

  1. number: the number you want to change to the absolute value.

Note :

  1. The ABS function can be used in later versions of SQL Server: SQL Server 2017, SQL Server 2016, SQL Server 2014, SQL Server 2012, SQL Server 2008 R2, SQL Server 2008, and SQL Server 2005.

For example

Take a look and explore some examples of ABS functions in SQL Server.

 SELECT ABS(-24); 
Result: 24

SELECT ABS(-24.6);
Result: 24.6

SELECT ABS(-24.65);
Result: 24.65

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

Previous post: UPPER function in SQL Server

Next article: Function AVG in SQL Server

4 ★ | 2 Vote

May be interested

  • AVG function in SQL ServerPhoto of AVG function in SQL Server
    the avg function in sql server returns the average value of an expression or average value according to the specified column of the selected row.
  • CEILING function in SQL ServerPhoto of CEILING function in SQL Server
    the ceiling function in sql server returns the smallest integer value greater than or equal to the transmitted numeric expression.
  • FLOOR function in SQL ServerPhoto of FLOOR function in SQL Server
    the floor function in sql server returns the largest integer value but less than or equal to the transmitted numeric expression.
  • COUNT function in SQL ServerPhoto of COUNT function in SQL Server
    this article will show you in detail how to use functions that handle count () numbers in sql server with specific syntax and examples to better visualize and capture functions.
  • MAX function in SQL ServerPhoto of MAX function in SQL Server
    the article will explore and show you how to use the max function in sql server to find the maximum value in a set.
  • MIN function in SQL ServerPhoto of MIN function in SQL Server
    the article will explore and show you how to use the min function in sql server to find the smallest value in a set.