如果我要将CSV file
导入Oracle
,我会使用此脚本:
sqlldr user/pass@host data=test.csv control=ctl\test.ctl log=log\test.log bad=bad\test.bad
日志导入和错误数据将保存在test.log和test.bad文件中。
如果我要将CSV file
导入Mysql
,我会使用此脚本:
LOAD DATA local INFILE 'test.csv'
INTO TABLE abc
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 LINES;
如何获取日志导入和错误数据文件?
答案 0 :(得分:1)
`load data local infile 'C:\\temp\\abc.csv'
into table table_name
fields terminated by ',' ignore 1 lines
(@col1,@col2,@col3,@col4)
set
table.column_name = @col1,
table.column_name = @col2,
table.column_name = @col3,
table.column_name = @col4;`
@ col1,@ col2,@ col3,@ col4是您的CSV文件列,根据您的表格列进行设置,如上所示