captured percentage values not inserting properly into table

2008-12-06 Thread Hagen Finley
Hi,

I am using Spreadsheet::ParseExcel, DBI  DBD::mysql to capture and
insert data into mysql tables. That's working out very well but I am
having issues with one datatype. When I capture percentages out of excel
97 the captured value might be 0.76324095 but when I attempt to select
that same data it always displays as 1 presumably rounding up. Within
mysql my select statements show either a 1 or 0:

mysql select de,cco,fcost,fmarg from quote;
++--+-+---+
| de | cco  | fcost   | fmarg |
++--+-+---+
| 1001812321 | 5885 |1228 | 1 |
| 1000267698 |   656160 |  292754 | 1 |
| 1001856764 |40150 |   20361 | 0 |
| 1000107528 |78830 |   39677 | 0 |
| 1001928870 |48062 |   16295 | 1 |

where fmarg is the percentage column. When I try and update the value
for fmarg I have the same issue:

mysql update quote set fmarg=0.984305 where de= 1001812321;
Query OK, 0 rows affected (0.10 sec)
Rows matched: 1  Changed: 0  Warnings: 0

mysql select de,cco,fcost,fmarg from quote;
++--+-+---+
| de | cco  | fcost   | fmarg |
++--+-+---+
| 1001812321 | 5885 |1228 | 1 |

The column datatype is INT(25).

| fmarg | int(25)  | YES  | | NULL|   |

Should I be using a different datatype for these kind of numerical
values? 

Thanks in advance for your kind counsel.

Hagen

-- 
Hagen Finley [EMAIL PROTECTED]
Boulder, CO


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: captured percentage values not inserting properly into table

2008-12-06 Thread Andy Shellam

Hello Hagen,

Hagen Finley wrote:

Should I be using a different datatype for these kind of numerical
values? 
  


Yes.  INT is by definition a whole number (0, 1, 2 etc.)
You will want to change the fmarg column to DOUBLE or DECIMAL.

Regards,

Andy

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]