Date: prev next · Thread: first prev next last
2016 Archives by date, by thread · List index


Hello again,
Can you use the LOAD DATA command under the mysql command client? You should
be able to fire this command also under phpmyadmin.
like so...
-------------------------------------------------
LOAD DATA INFILE "/directory/.../filename.csv"
REPLACE
INTO TABLE table1
FIELDS ENCLOSED BY '"' TERMINATED BY ','
LINES TERMINATED BY '\n'
IGNORE 1 LINES
;       
-------------------------------------------------
The first line would contain the names of the columns, therefore "IGNORE 1 LINES",
REPLACE means that if you load the data into an already existing table, tuples
which already exist will be overwritten.
LOAD DATA is described in more detail in the MySQL documentation.
Regards
H. Stoellinger

On Wed, 20 Jan 2016 11:05:51 +0100, Ian Whitfield <whitfield@telkomsa.net> wrote:

Hi All

I have been trying to import a CSV file from Calc into MySQL to run with
Base for over a week now and can not believe this is so difficult to do
so I'm hoping some other Base users might have cracked this one!!

My OpSys is PClinuxOS - 32-bit and MySQL is ver 5.1.73. Everything is
running on localhost.

My CSV file is in Calc and has 2600 rows and 78 cols. I save it as a CSV
file which is 717.8Kb in size. Field Names are in row 1.

I have tried many times with phpMyAdmin with no luck and today I
installed MySQL Workbench - also no luck.

In all cases I get the error ...

MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near 'varchar(10), `NULL` varchar(10), `NULL` varchar(10), `NULL`
varchar(21), `NULL` ' at line 1

MyAdmin seems to stop after only 38 fields and the error does not show
the field names in the error. Also it is not MY SQL syntax it is
MyAdmin's syntax!!

Workbench says - ERROR 1064 (42000) at line 1: You have an error in your
SQL syntax; check the manual that corresponds to your MySQL server
version for the right syntax to use near
'RecordID,Status,StatusGraphic,Title,PrefFirstName,FirstName,LastName,Maiden/Form'
at line 1
Operation failed with exitcode 1.

Can anyone help me out please. I'm NOT a Database expert just a user and
must get this DB up and running again ASAP!!

Many, many thanks

IanW
Pretoria RSA



--
Erstellt mit Operas revolutionärem E-Mail-Modul: http://www.opera.com/mail/

--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.