Chetan
Chetan

Reputation: 76

Retrieving double value from MySQL

I.m storing the value 123456789.00 in an SQL column of float type, but when I'm retrieving it, the result set gives returns 1.23456789E8. I want it to retrieved the value exactly like stored, i.e. 123456789.00.

Upvotes: 1

Views: 1943

Answers (4)

raydpark
raydpark

Reputation: 1

I'm not sure but I think 123456789.00 is too big number to store into a MySQL float type. You need to reformat when you retrieve the value, or change the type (to a double or varchar, for example).

Upvotes: 0

odbhut.shei.chhele
odbhut.shei.chhele

Reputation: 6254

You can always store it as VARCHAR and when you retrieve it, convert it into double.

Upvotes: 0

Masudul
Masudul

Reputation: 21961

If you want store floating point value with precision than mysql column type should be DECIMAL(size, precision). Here maximum size is 64. So, use DECIMAL instead of float.

Upvotes: 2

Sush
Sush

Reputation: 317

You can use following query for retrieving value

SELECT FORMAT(Column_Name,2) FROM TableName

Upvotes: 0

Related Questions