# SQL abs Function | Absolute Value of an Integer

SQL abs is an inbuilt Math function in SQL Server. It returns the absolute (positive) value of a number. It is identical to modulus in mathematics. In this article, we will discuss the abs Function in SQL Server. Also, we will discuss examples of using it.

ABS (number)

## Parameters

The function expects only one parameter. The number for which you want to find the absolute value is the input to the function.

## Return Value

The function returns the absolute value of the number input to it.

```Input: ABS(10)
Output: 10

Input: ABS(3.5)
Output: 3.5

Input: ABS(-10)
Output: 10

Input: ABS(-3.5)
Output: 3.5

Input: ABS(0)
Output: 0```

## Examples

For instance, consider the following examples of using the function in SQL Queries.

```mysql> SELECT ABS(10);
+---------+
| ABS(10) |
+---------+
|      10 |
+---------+

mysql> SELECT ABS(-10);
+----------+
| ABS(-10) |
+----------+
|       10 |
+----------+

mysql> SELECT ABS(3.5);
+----------+
| ABS(3.5) |
+----------+
|      3.5 |
+----------+

mysql> SELECT ABS(-3.5);
+-----------+
| ABS(-3.5) |
+-----------+
|       3.5 |
+-----------+```

## Conclusion

In conclusion, we discussed the ABS function in SQL Server. It can be used to ensure that the number in a variable is always positive. You can more about it on the Official Microsoft Documentation. Additionally, you can also learn about more SQL Math Functions on Concatly.