Forum Discussion
odata pull - calculations not pulling correctly
- 4 years ago
Hi ak105
The results are correct because both dividend and divisor are Integers. When you use div or /, it returns the data type of the argument with the higher precedence. For more information, see Data Type Precedence (Transact-SQL). If an integer dividend is divided by an integer divisor, the result is an integer that has any fractional part of the result truncated. Reference: / (Division) (Transact-SQL).
To have the percentage fields return decimal numbers, you can convert the dividends or divisors to float or decimal data types.
Data type conversion (Database Engine)
CAST and CONVERT (Transact-SQL)
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Hi ak105
The results are correct because both dividend and divisor are Integers. When you use div or /, it returns the data type of the argument with the higher precedence. For more information, see Data Type Precedence (Transact-SQL). If an integer dividend is divided by an integer divisor, the result is an integer that has any fractional part of the result truncated. Reference: / (Division) (Transact-SQL).
To have the percentage fields return decimal numbers, you can convert the dividends or divisors to float or decimal data types.
Data type conversion (Database Engine)
CAST and CONVERT (Transact-SQL)
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.