Charles Lewis writes:
> I have the following command:
> mysqlimport -d -c, --columns=DATE,TIME,MSG --fields-terminated-by=,
> --fields-enclosed-by=, dbase c:\file.txt
>
> This reads the following from a text file:
> 26 Sep 2001, 05:42:24 : Text message to be read.
>
> The date and time separator is a "," and the time and message separator
> is a ":" But the time field is also split up with ":" where as I don't
> want to split up the time field.
As far as I can see from your example, date and time are not separated
by ",", but by ", ". Also, time and text are separated by " : " rather
than just ":". The real problem here is that you have two different
column separators, which is not supported as far as I know. What
you could do is import the whole lines to a temporary table and then
use another query to actually get it into the table where you want it.
An easier solution would be to use sed (or some other tool) to reformat
the lines, but since you're apparently on Windows that's probably not
an option.
Another thing I noticed: You're using "--fields-enclosed-by=," but
your fields aren't enclosed by commas. If they were, it would look
something like this, assuming that they were separated by commas:
,26 Sep 2001,,,05:42:24,,,Text message to be read.,
//C
--
Carl Troein - Círdan / Istari-PixelMagic - UIN 16353280
[EMAIL PROTECTED] | http://pixelmagic.dyndns.org/~cirdan/
Amiga user since '89, and damned proud of it too.
---------------------------------------------------------------------
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