|
Posted by Ulf Wendel on 10/06/05 18:17
milagro wrote:
> The LOAD statement:
>
> LOAD DATA INFILE '/home/data.csv' into table data2 FIELDS TERMINATED BY
> ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n';
>
> The data string is very long. To simplify matters I'll give you and
> example of the field whose data I'm having problems with:
> "*955665"
Ok, last question: what's the column type of the column that's supposed
to hold "*9555655". If it's a numerical datatype, I'm not too much
surprised by the result. I mean, if you try to convert "*955655" into a
numerical datatype, MySQL won't give you 9555655. The conversion will
stop at the first non digit character.
For example, if you try to convert "12*3" as an unsigned integer, MySQL
will interpret it as 12. Try:
SELECT CAST("*1" AS SIGNED), CAST("1*" AS SIGNED), CAST("12*3" AS SIGNED)
If that's the problem for you, clean up you data before loading or load
the data to a charachter column and clean it up inside the database
using string function before you copy the data into it's final destination.
Ulf
--
Internet Super Hero - It's all about Nixnutz
http://www.internetsuperhero.de
Navigation:
[Reply to this message]
|