Hello everyone,
When I run the select statement below, sql returns 91.00
When I use a calculator, the return is 91.389971
I would like the return to be 91.38, what am I doing wrong?
Integer math is occurring before the cast operation.
Try this:
Code:
select CAST(858426/9393[!].0[/!] AS DECIMAL(10,2))
Without the .0, SQL interprets the values as integer, so integer math happens. By adding .0, sql interprets this as a decimal number, and you get the correct results.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.