MySQL Forums
Forum List  »  Newbie

Loading table from CSV - Help required
Posted by: Subramanian Santhanam
Date: February 02, 2009 08:20PM


I have a table like this

create table test(emp_no integer primary key,
emp_name varchar(25),
doj date);

I have to load it with the following CSV file


I used the following load data query to load my table

load data local infile 'f:\\tools\\uploader wfm\\load.csv' into table
test fields terminated by ',' optionally enclosed by '"'
lines terminated by '\r\n';

The following is the output of the above query

Query OK, 3 rows affected, 1 warning (0.03 sec)
Records: 4 Deleted: 0 Skipped: 1 Warnings: 1

I executed show errors and show warnings command. The results are as follows

mysql> show errors;
Empty set (0.00 sec)

mysql> show warnings;
| Level | Code | Message |
| Warning | 1265 | Data truncated for column 'doj' at row 4 |
1 row in set (0.00 sec)

The issue here is I am not getting any clue about the rejected rows. How to get the info about the rejected rows?

The following is the content of my table after upload.

mysql> select * from test;
| emp_no | emp_name | doj |
| 1 | Sam,Daniel | 2008-11-01 |
| 2 | Jennifer,Jane | 2008-05-11 |
| 4 | David,Alfred | 0000-00-00 |
3 rows in set (0.00 sec)

Thanks & Regards,
Subbu S.

Options: ReplyQuote

Written By
Loading table from CSV - Help required
February 02, 2009 08:20PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.