Returns the positive (+1), zero (0), or negative (-1) sign of the given expression.

SIGN (numeric_expression )

Arguments

  • numeric_expression
    An expression of the exact numeric or approximate numeric data type categories, or types that are implicitly convertible to float (except for the bit data type).

Returns the same type as numeric_expression except for the following expressions.

Specified expression

Return type

tinyint, smallint

int

real/float

float

Nonnumeric types that can be implicitly converted to float

float

Example

The following example returns the SIGN of the difference between the units of products in stock and units of products that have been ordered in the Productstable.

SELECT ([Units In Stock] - [Units On Order]), SIGN([Units In Stock] - [Units On Order])
FROM Products