"Senthil Kumar K" <[EMAIL PROTECTED]> wrote on 11/08/2005 08:31:28 
AM:

> Hi all,
> 
> i want to upgrade Mysql 3.23 to 4.1.14-standard.
> 
> I've a table with the following structure in Mysql 3.23.
> 
> 
> + create table test ( amount double(8,4) );
> + insert into test set amount = 123456;
> + mysql> select * from test;
>  +-------------+
>  | amount      |
>  +-------------+
>  | 123456.0000 |
>  +-------------+
>  1 row in set (0.00 sec)
> 
> 
> If i try to attach this data to Mysql 4.1.14-standard.
> 
> It is truncating the value to 9999.9999
> 
> 
> Is there any way to solve this issue without chaning the db structure... 
?
> 
> 
> Regards,
> Senthil
> 
> 

No. The version you are using is bugged. It allowed you to do something 
that violated your own definition. The version you are moving to fixes 
that problem but because you already have data in a field that is TOO BIG 
FOR THE FIELD if you do not enlarge your field, you will encounter the 
"truncate to max value" behavior of MySQL.

The problem:
You defined your field as  (8,4) which means that you can have at most an 
8 digit number with 4 of those digits to the right of the decimal point. 
The biggest value that meets that criteria is 9999.9999

The number you want to store (123456.0000) has 10 numbers, 4 of which are 
decimal places. You need a field defined as (10,4) or larger to hold this 
value.

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

Reply via email to