SQL Server SIGN() Function
THE WORLD'S LARGEST WEB DEVELOPER SITE

SQL Server SIGN() Function

❮ SQL Server Functions

Example

Return the sign of a number:

SELECT SIGN(255.5);
Try it Yourself »

Definition and Usage

The SIGN() function returns a value indicating the sign of a number.

This function will return one of the following:

  • If number > 0, it returns 1
  • If number = 0, it returns 0
  • If number < 0, it returns -1

Syntax

SIGN(number)

Parameter Values

Parameter Description
number Required. The number to return the sign for

Technical Details

Works in: SQL Server 2014, SQL Server 2012, SQL Server 2008 R2, SQL Server 2008, SQL Server 2005

More Examples

Example

Return the sign of a number:

SELECT SIGN(-12);
Try it Yourself »

❮ SQL Server Functions