SIGN (TSQL Function)

Returns -1 if argument is < 0, 0 if argument == 0, 1 if argument is > 0.

Syntax

SIGN ( numeric_expression )

Arguments

numeric_expression
is a numeric expression of type int, bigint, money, numeric, float.

Return Types

Returns the same type as numeric_expression.

Examples

PRINT SIGN(123), SIGN(-123.45e0), SIGN($123.45), SIGN(123.45), SIGN(-123.45), SIGN(0.0);

The result is:

          1|                  -1|               1.0000|   1|  -1|   0|