Adaptive Server uses these arithmetic operators:
Operator |
Meaning |
---|---|
+ |
Addition |
– |
Subtraction |
* |
Multiplication |
/ |
Division |
% |
Modulo (Transact-SQL extension) |
You can use addition, subtraction, division, and multiplication on exact numeric, approximate numeric, and money type columns.
A modulo operator, which can be used on exact numeric columns except money and numeric, finds the remainder after a division involving two numbers. For example, using integers: 21 % 11 = 10 because 21 divided by 11 equals 1, with a remainder of 10. You can obtain a non-interger result with numeric or decimal datatypes: 1.2 % 0.07 = 0.01 because 1.2 / 0.07 = 17 * 0.07 + 0.01. You receive similar results from float and real datatype calculations: 1.2e0 % 0.07 = 0.010000.
When you perform arithmetic operations on mixed datatypes (for example, float and int) Adaptive Server follows specific rules for determining the type of the result. See Chapter 6, “Using and Creating Datatypes,” for more information.
Copyright © 2005. Sybase Inc. All rights reserved. |