SQL SIGN Function | Return Sign of a Number

SQL SIGN is an inbuilt Math Function in SQL Server. It returns the sign of a number (1 if the number if positive, -1 for negative). In this article, we will discuss the SQL SIGN Function. Also, we will discuss a few examples of using it.


SIGN (number)


The function expects only one parameter. The number whose sign you want to determine is the input to the function.

Return Value

The function returns the sign of the input number.

  • +1 if the number is positive.
  • -1 if the number is negative.
  • 0 if the number is 0.
Input: SIGN (10)
Output: 1

Input: SIGN (-10)
Output: -1

Input: SIGN (0)
Output: 0
SQL SIGN Function


The function works in SQL Server (starting with 2008), Azure SQL Database, Azure SQL Data Warehouse and Parallel Data Warehouse.


Let’s consider a few examples of using the function.

Example 1: Positive Number

The function returns 1 if the input number is positive.

mysql> SELECT SIGN(10);
| SIGN(10) |
|        1 |

Example 2: Negative Number

Also, it returns -1 if the number is negative.

mysql> SELECT SIGN(-10);
| SIGN(-10) |
|        -1 |

Example 3: Zero

However, the function returns 0 if the number is 0.

mysql> SELECT SIGN(0);
| SIGN(0) |
|       0 |


In conclusion, we discussed the SQL SIGN Function. You can read more about it in the Microsoft Official Documentation. Additionally, you can read about more SQL Math Functions on Concatly.

Spread the Knowledge

Leave a Reply

Your email address will not be published. Required fields are marked *