Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
% (Modulo)

% (Modulo)

SQL Server 2000

Provides the remainder of one number divided by another.

Syntax
dividend % divisor
Arguments
dividend
Is the numeric expression to divide. dividend must be any valid expression in Microsoft® SQL Server™ 2000 Windows® CE Edition (SQL Server CE) of the integer data type category.
divisor
Is the numeric expression to divide the dividend by. divisor must be any valid SQL Server expression of any of the data types of the integer data type category.
Result Types

int

Examples

The following example uses modulo to identify employees in the Northwind database with even-numbered EmployeeID values.

SELECT EmployeeID, LastName, EmployeeID % 2 FROM Employees WHERE EmployeeID % 2 = '0'

This is the result set:

EmployeeID   LastName   #2
----------   --------   ---
2            Fuller     0
4            Peacock    0
6            Suyama     0
8            Callahan   0

Show:
© 2015 Microsoft