David,
Ian's response looks fine, I would just add 'OPTIONALLY' to the 'ENCLOSED ' parameter:
mysql -e "LOAD DATA INFILE '/home/dlubowa/clients.csv' INTO TABLE bush FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ".
This may not work if your entire record is wrapped in quotes as indicated in your email. In this case you are going to need to cure your import file by removing the first and last quote that wraps your record.
I hope this helps.
Pat...
[EMAIL PROTECTED] CocoNet Corporation SW Florida's First ISP
there are just two issues that I would look at if his solution
----- Original Message ----- From: "Ian Sales" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; "Patrick Sherrill" <[EMAIL PROTECTED]>
Sent: Thursday, December 09, 2004 9:53 AM
Subject: Re: Excel 2 mysql
David Ziggy Lubowa wrote:
On Thursday 09 December 2004 14:33, David Ziggy Lubowa wrote:
On Wednesday 08 December 2004 05:07, Patrick Sherrill wrote:
mysql -e "LOAD DATA INFILE '/home/dlubowa/clients.csv' INTO TABLE bush " -p testDavid, Please provide the complete LOAD DATA INFILE command you used.
this is test output that is in my test table, this is how my info is
mysql> select * from bush;
+----------------------------------------------------+----------+---------+---------+---------+--------+
| clients | location | service | PhoneNo | contact | emails |
+----------------------------------------------------+----------+---------+---------+---------+--------+
| | NULL | NULL | NULL | NULL | NULL |
| "CRS", "Nsambya", "HSDN 350" , "041-267733 / 077-7 | NULL | NULL | NULL | NULL | NULL |
+----------------------------------------------------+----------+---------+---------+---------+--------+
sorry for the distorted info, but basically the " "CRS", "Nsambya", "HSDN 350" , "041-267733 / 077-7 " are all under clients field, Yet the info is supposed to be distributed to all the columns of the table. What could i be doing wrong here.
- add FIELDS TERMINATED BY ',' ENCLOSED BY '"' to your LOAD DATA INFILE
- ian
-- +-------------------------------------------------------------------+ | Ian Sales Database Administrator | | | | eBuyer http://www.ebuyer.com | +-------------------------------------------------------------------+
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]