SqlExpression MOD
From Eigenpedia
Contents |
Syntax
MOD( dividend, divisor )
Purpose
Returns the remainder of the dividend divided by the divisor. Both values must have scale 0.
Input
- dividend - the value to be divided. Must have scale 0.
- divisor - the value to be divided by. Must have scale 0.
Output
- [NUMERIC] - the remainder of the dividend divided by the divisor.
- Returns null if either input is null
- If divisor is 0 an exception is raised
- result will have the same sign as the dividend
Example
| Function | Result |
|---|---|
| MOD(8, 5) | 3 |
| MOD(12, -7) | 5 |
| MOD(CAST(-9 AS TINYINT), CAST(7 AS DECIMAL(2, 0))) | -2 |

