Функция модуля в Microsoft SQL Server работает только для определенных типов данных.
Согласно статье MSDN [1] об операторе модуля, вы обычно используете модуль, подобный этому ...
dividend % divisor
dividend
Is the numeric expression to divide. 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.
divisor
Is the numeric expression by which to divide the dividend.
divisor must be any valid expression of any one of the data
types in the integer and monetary data type categories, or
the numeric data type.
Однако это не работает, когда дивиденд является типом данных с плавающей запятой. Ответ, который мы придумали, приведен ниже для дальнейшего использования.
[1] http://msdn.microsoft.com/en-us/library/ms190279.aspx