A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  special characters  sybase-tech-blog


Category: ASE: Functions: Mathematical Functions

sign()

The mathematical function sign() returns the algebraic sign for the value declared in the parameter "number". Positive values return "1", negative values return "-1" and the number zero returns "0".

Syntax of the Mathematical Function sign()

    sign(number)
    

The parameter "number" of the Mathematical Function sign()

number
The parameter "number" is a placeholder for a number which must be of one of the datatypes numeric, decimal, tinyint, smallint, int, bigint (from ASE® version 15.0), float, real, double precision or money. Additionally, the parameter "number" recognises any other datatype which can be converted into one of the required datatypes using implicit conversion.

Example for the Mathematical Function sign()

    select sign(-124.12)
go
-----
-1.00

Returns -1.00.

    select sign(124.12)
go
-----
1.00

Returns 1.00.

    select sign(0)
go
-----
0

Returns 0.

See also:

ASE T-SQL - Aggregate Functions,
Mathematical Functions,
abs(),
acos(),
asin(),
atan(),
atn2(),
ceiling(),
cos(),
cot(),
degrees(),
exp(),
floor(),
log(),
log10(),
pi(),
power(),
radians(),
rand(),
round(),
sin(),
sqrt(),
tan().