Hi Am developing one application in java and Am using sql server database . I'm inserting values in database in 23.6 but its appending like 23.645464 . is there any method to append after decimal no only one digit. please help me.
Thanks
Hi Am developing one application in java and Am using sql server database . I'm inserting values in database in 23.6 but its appending like 23.645464 . is there any method to append after decimal no only one digit. please help me.
Thanks
how about this in sql server.
SELECT round (cast(23.645464 AS DECIMAL(10,1)),2);
Hey you can try this code in Java file before storing value in database..
For example :
Function call :
float round = Round(num,1);
Definition:
public static float Round(float val, int dec) {
float p = (float)Math.pow(10,dec);
val = val * p;
float tmp = Math.round(val);
return (float)tmp/p;
}