|
发表于 2011-10-31 13:45:51
|
显示全部楼层
Re:≈请问MYSQL使用LOAD时如何跳过数据格式錯誤的
mysql> set session sql_mode=traditional;
Query OK, 0 rows affected (0.00 sec)
mysql> set global sql_mode=traditional;
Query OK, 0 rows affected (0.00 sec)
mysql> delete from aa;
Query OK, 3 rows affected (0.00 sec)
mysql> load data local infile '/home/wanghai01/data/customer_20111022.dat' into table aa fields terminated by',' lines terminated by'\\n';
Query OK, 3 rows affected, 1 warning (0.00 sec)
Records: 3 Deleted: 0 Skipped: 0 Warnings: 1
mysql> show warnings;
+---------+------+--------------------------------------------+
| Level | Code | Message |
+---------+------+--------------------------------------------+
| Warning | 1261 | Row 1 doesn't contain data for all columns |
+---------+------+--------------------------------------------+
1 row in set (0.00 sec)
mysql> select * from aa;
+------+------------+---------------------+
| id | name | ins_date |
+------+------------+---------------------+
| 11 | 2011-01-01 | NULL |
| 33 | xx | 2011-01-01 00:00:00 |
| 22 | hehe | 2011-01-01 00:00:00 |
+------+------------+---------------------+
3 rows in set (0.00 sec)
mysql>
谢谢回答,结果還是不行。 |
|