In this post explains how to use the SIGN function in SQL Server (Transact-SQL) with syntax and examples.
In SQL Server (Transact-SQL), the SIGN function returns a value indicating the sign of a number.
The syntax for the SIGN function in SQL Server (Transact-SQL) is:
SIGN( number )
The number to test for its sign.
The SIGN function can be used in the following versions of SQL Server (Transact-SQL):
Let's look at some SQL Server SIGN function examples and explore how to use the SIGN function in SQL Server (Transact-SQL).
For example:
SELECT SIGN(-23);
Output: -1
SELECT SIGN(-0.1);
Output: -1.0
SELECT SIGN(0);
Output: 0
SELECT SIGN(0.1);
Output: 1.0
SELECT SIGN(14);
Output: 1