1
I am having a JAVA problem where I want to store calculation results with only 2 decimal places in SQL Server. For that at the end of my calculations I perform:
Math.round(valor * 100.0f) / 100.0f;
to obtain the value to two decimal places. After entering the values in the bank I am consulting them and are really only stored with 2 decimal places.
When do I requisition SELECT they are coming with 2 decimal places too.
But the weird thing happens when I try add up two of these values, the result of this sum gives a number with 4 decimal places, follows debug picture:
What could be going on? This rounding is right?
--
In addition to making the requisition of INSERT (just to make sure that the value will be entered to 2 decimal places):
INSERT INTO tableX (valor) values (ROUND(?,2))
However it continues to result in a number of 4 decimal places after the sum.