我有一个从oracle数据库导出的csv文件(12 gb),
格式化为
6436,...,N ,,,,,,,,,,,, 4月1日/ 1999,04 / 01 / 1999,352,1270,1270,406,406,1999,1,31 / 01 / 1999,0 ,88,0,A 11/12/2005,N,0,11 /二千○五分之十二,,,, 1270,1,0,2974 ,,,,,,,,,,,,,,,, ,,,,,,,,
如你所见它有很多空值(大多数是整数), 当我将它导入mysql数据库时,它用零填充空值
像,
6436,0,0,0,0,0,0,0,0,0,0,0,0,4,04 / 01 / 1999,04 / 01 / 1999,1270,1270,406,406, 1999,1,31,31 / 01 / 1999,88,0,A,第11/12/2005,N,0,11 / 12 / 2005,0,0,0,1270,1,0,2974,0 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,,, 0,0,00 / 00 / 0000,0,0,0
这里真正的问题是什么? 感谢。
答案 0 :(得分:0)
我通过@Marc B
的有用评论来解决这个问题我写了类似
的内容LOAD DATA LOCAL INFILE '/path/data.csv' INTO TABLE table_name
FIELDS TERMINATED BY ','
IGNORE 1 LINES
(columns with @)
SET
column = IF(length(@column)= 0,null,@column),
date = str_to_date(@date, '%d/%m/%Y');