Export (0) Print
Expand All
Expand Minimize

SIGN (SQL Server Compact Edition)

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


SIGN ( numeric_expression ) 

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

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 Products table.

SELECT (UnitsInStock - UnitsOnOrder), SIGN(UnitsInStock - UnitsOnOrder)
FROM Products
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft