Use "optionally":

mysql> LOAD DATA INFILE '/home/sql/data.csv' INTO TABLE csvdata
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY
'\n';

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 31, 2001 9:33 AM
To: [EMAIL PROTECTED]
Subject: Load data infile


Hi

I'm working on importing csv datafile returns Warnings, after carefully
checking data I noticed that there are double quotes (") inside the
records.

mysql> LOAD DATA INFILE '/home/sql/data.csv' INTO TABLE csvdata
FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\n';
Query OK, 20000 rows affected (1.58 sec)
Records: 20000  Deleted: 0  Skipped: 0  Warnings: 572

Example of line that fails:
"data","data","some "text" and" text"\n

Any quick solutions, regarding mysql import?

Thanks

sql,table,database,query,mysql


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to