Why modulo runs fine with decimal but not with float/real
MSDN states about it “must be a valid expression of any one of the data types in the integer and monetary data type categories, or the numeric data type.” why not floating values, because it is an approximate value ??
--Runs fine
declare @pri decimal
set @pri = 3.25
select @pri%2
Result 1
--Gives an error 402
declare @pri float
set @pri = 3.25
select @pri%2
Msg 402, Level 16, State 1, Line 3
The data types float and numeric are incompatible in the modulo operator.
If your question about the documentation?
MSDN documentation
It says integer, monetary (money, smallmoney) and numeric
So, decimal is not supported. The documentation says “numeric is functionally same as decimal” but may be it has different meaning in some context like this one.
I guess, float is treated as numeric datatype where as decimal is not
Read the data types. It has information on monetary data types. (money, smallmoney)
Update:
Here is the catagory wise data type list. You can follow the links to numeric and money to find what datatypes falls in it