- If you execute
SELECT -100/-100*10
the result is0
. - If you execute
SELECT (-100/-100)*10
the result is10
. - If you execute
SELECT -100/(-100*10)
the result is0
. - If you execute
SELECT 100/100*10
the result is10
.
BOL states:
When two operators in an expression have the same operator precedence level, they are evaluated left to right based on their position in the expression.
And
Level Operators
1 ~ (Bitwise NOT)
2 * (Multiplication), / (Division), % (Modulus)
3 + (Positive), - (Negative), + (Addition), + (Concatenation), - (Subtraction), & (Bitwise AND), ^ (Bitwise Exclusive OR), | (Bitwise OR)
Is BOL wrong, or am I missing something? It seems the -
is throwing the (expected) precedence off.