SIGN() function :
This function in SQL Server is used to return the sign of the specified number. It returns 1 if the number is positive, -1 if the number is negative and 0 for zero number.
Features:
- This function is used to find the sign of the given number i.e., that given number is positive or negative or zero.
- This function accepts only all types of numbers i.e., positive, negative, and zero.
- This function also accepts fraction numbers.
- This function always returns 1 if the number is positive, -1 if the number is negative and 0 for zero number.
Syntax :
SIGN(number)
Parameter :
This method accepts a parameter as given below :
- number : Specified number to return the sign for.
Returns :
It returns the sign of the specified number.
Example:
Getting the result as 1 i.e., positive for the specified number 2.
SELECT SIGN(2);
Output :
1