You are here: Re: how to handle special asterik in input data « MySQL Databases « IT news, forums, messages
Re: how to handle special asterik in input data

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация