I have a flat file that I am trying to load to a MySQL database (fixed-length fields).
When I try:
LOAD DATA '/mypath/flatfile.txt' INTO TABLE mytable
It is generating a ton of errors, but the end result is that it's populating only the first field for all records and all subsequent fields are NULL
check the field separator .. perhaps, u are using a non-default separator, and have not specified what the field separation character should be.
Any suggestions?
You could also try using mysqlimport ...
eg: mysqlimport -u <userid> -p <pw> -r --fields-terminated-by='<field-separation-char>' <database-name>
Look up the command syntax .. -r above would replace duplicates, and there is a -i to ignore duplicates. If the ordering of the fields within the flatfile does not correspond with the fields in the DB, then you will also need to specify the columnts to be loaded ..
The only problem is that you may need to run mysqlimport as root ... have not yet found a way to run it as a non-root user .. yet.
hth
--carl
Tried these too: LOAD DATA '/mypath/flatfile.txt' INTO TABLE mytable lines terminated by '\n\' LOAD DATA '/mypath/flatfile.txt' INTO TABLE mytable lines terminated by '\r\n\'
No go
:-(
Thanks!
Rw
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]