I have done a lot of looking and search through archives of mailing lists
and newsgroups and I guess I haven't looked enough because "I still haven't
found what I'm looking for."  What I have is an Excel worksheet that had 26
fields and several hundred rows of data.  The data types will be are INT,
TINYTEXT, and TEXT when they finally make it into MySQL.  The TEXT and
TINYTEXT fields contain commas, double quotes, single quotes, ampersands,
dollarsigns, periods, and HTML tags.  When I export it to CSV some of the
TEXT and TINYTEXT fields only contain alpha characters and so they don't get
quoted.

My problem:  I need all of the TEXT and TINYTEXT fields to be quoted and all
of the INT fields to not be quoted (of course).

Currently when I export to CSV and then LOAD DATA INTO MySql I get the
error:
ERROR 1062: Duplicate entry '1' for key 1

My import query is:
LOAD DATA INFILE 'filename.csv' INTO TABLE tablename
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY
'\n';

I have check out the "Text Write" macro program and it doesn't take my need
to have some fields quoted but not others into accout.

I am sure someone else out there has done this.  I am wondering what the
best way to go about this is.  Any help is greatly appreciated.

Thank you,
Jonathan Duncan


---------------------------------------------------------------------
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