开发者

MySQL: Numbers format

I want to use mysql LOAD DATA to import CSV file. Numbers in my CSV have thousands separated by space, ie. 14 987 000. MySQL truncates it to 14 while importing. Is there any way to overcome this limitation 开发者_开发百科without altering CSV source file?

P.S. I don't want to change field type from INT to VARCHAR.

Thank you


Try:

REPLACE('14 987 000', ' ', '');

E.g.

LOAD DATA INFILE 'file.csv'
INTO TABLE t1(column1, column2, @number_column_value)
SET number_column = REPLACE(@number_column_value, ' ', '')


I don't believe so... You can write a script and to it for you.

If there is a way for MySQL to do it directly I'd like to know as well!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜