Skip to content
Advertisement

how to resolve data type incompatability issue in SQL server

I have been trying to build below logic

But i am getting below error

Msg 402, Level 16, State 1, Line 19 The data types float and numeric are incompatible in the modulo operator.

Advertisement

Answer

Just cast to INT before performing the modulo:

Here is the complete code:

The issue is you are not allowed to perform modulo, because:

dividend 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.

and even you multiply with 100, you are not changing the type.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement