MS Access Sgn() Function
The Sgn()
function in MS Access is a simple mathematical function that determines the sign of a number and returns a value indicating whether the number is positive, negative, or zero.
Sgn(): Definition and Usage
This function is useful in situations where you need to check the sign of a number for conditional logic or calculations. It's a quick way to categorize numbers without needing the actual value.
Return Values
The Sgn()
function returns:
1
if the number is positive (greater than 0)0
if the number is zero-1
if the number is negative (less than 0)
Syntax
Syntax
Sgn(number)
Parameter Values
Parameter | Description |
---|---|
number |
The number whose sign you want to determine. This is a required numeric value. |
Example
Determining the Sign of a Number
This example demonstrates how to use the Sgn()
function to find the sign of 243.5.
Syntax
SELECT Sgn(243.5) AS SgnNum;
Output
1