in er wrote:
> I have the table structure seen below.
> When inserting hcp which is float I always get the result 9.9 ?
> mysql> insert into hcp values (null,4,'2005-08-13',10.0);
> Then:
> mysql> select * from hcp; and the last value is now 9.9 ??
> ...
> hcp | float(2,1) | | | 0.0
From
http://dev.mysql.com/doc/mysql/en/numeric-types.html:
MySQL allows a non-standard syntax: FLOAT(M,D) or REAL(M,D) or DOUBLE PRECISION(M,D). Here, “(M,D)” means than values are displayed with up to M decimal digits in total, of which D decimal digits may be after the decimal point.
From this:
the largest number you can store in your float(2,1) column is 9.9. Everything (e.g. 10.0) larger than 9.9 will be truncated to 9.9. You get a warning about this. Why are you using float(2,1)? Why are you using float at all?
--
felix
Please use
BBCode to format your messages in this forum.