SIGN Function [Numeric]

Returns the sign of a number.

Syntax

SIGNnumeric-expression )

Parameters

Parameter

Description

numeric-expression

The number for which the sign is to be returned.

Returns

SMALLINT

Example

The following statement returns the value -1:

SELECT SIGN( -550 ) FROM iq_dummy

Usage

For negative numbers, SIGN returns -1.

For zero, SIGN returns 0.

For positive numbers, SIGN returns 1.

Standards and Compatibility

  • SQL—Vendor extension to ISO/ANSI SQL grammar.

  • Sybase—Compatible with Adaptive Server Enterprise.