MOD function [Numeric]

Returns the remainder when one whole number is divided by another.

Syntax
MOD( dividend, divisor )
Parameters
  • dividend   The dividend, or numerator of the division.

  • divisor   The divisor, or denominator of the division.

Returns

SMALLINT

INT

NUMERIC

Remarks

Division involving a negative dividend gives a negative or zero result. The sign of the divisor has no effect.

See also
Standards and compatibility
  • SQL/2003   SQL foundation feature outside core SQL.

Example

The following statement returns the value 2.

SELECT MOD( 5, 3 );