Generate errors when loading table

Generate errors when loading table

am 16.10.2011 19:15:13 von PengYu.UT

Hi,

I have the following table and sql commands. The number of fields in
the file is different from that of the schema. And the last line
should not contain null. But there are only warnings but not errors
generated. I'm wondering how to generate errors instead of warnings.

~/linux/test/mysql/mysql/LOAD_DATA/csv$ cat table.csv
1,a,u
2,"b""x",v
3,"c,e",w
4,defg,x
,

~/linux/test/mysql/mysql/LOAD_DATA/csv$ mysqllocalhostpengy.sh
/Applications/MAMP/Library/bin/mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 45
Server version: 5.5.9 Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SET sql_mode = 'STRICT_TRANS_TABLES';
Query OK, 0 rows affected (0.00 sec)

mysql> use test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> CREATE TEMPORARY TABLE test (
-> id INTEGER
-> , name VARCHAR(3) NOT NULL
-> );
Query OK, 0 rows affected (0.02 sec)

mysql> load data local infile 'table.csv' into table test FIELDS
TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'; -- ESCAPED BY '"';
Query OK, 5 rows affected, 7 warnings (0.03 sec)
Records: 5 Deleted: 0 Skipped: 0 Warnings: 7



--
Regards,
Peng

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org