Well, I don't really agree with that.

I've tried to load data in file with a datetime field and it worked very
well.

Obviously, I could advice you to create a field with datetime type and
don't forget to format your input datetime in your file like that:

"aaaa-mm-jj hh:min:ss"  (without the quotes)

where aaaa means year, mm month, jj day, hh hour, min minutes and ss
seconds. I noticed that ss is facultative and there is a space character
between date and time.

Good luck

Yohan Valette




Egor Egorov <[EMAIL PROTECTED]> on 24/12/2002 10:42:00

To:    [EMAIL PROTECTED]
cc:

Subject:    re: now() function not working with load data infile


On Tuesday 24 December 2002 10:30, [EMAIL PROTECTED] wrote:

> I've created a test table with two columns.  The first
> one is a varchar type for inputting first names.  The
> second column is datetime.  The table will eventually
> expand to include a timestamp column, so I am not
> interested in getting that to work at this time.
>
> If I use MySQL monitor, I can use the now() function
> to insert the current date/time into the datetime
> column.
>
> When using load data infile, only the varchar column
> shows a value, but the datetime column shows a string
> of zeros.  I don't understand why using MySQL monitor
> works for now() function, but I can't reproduce this
> when using load data infile.  The syntax for my load
> data infile statement is as follows:
>
> load data infile "/home/test/mysql_test.txt" into
> table Test fields terminated by "," enclosed by "\""
> lines terminated by '\n';
>
> The contents of my text file (mysql_test.txt) are as
> follows:
>
> firstName, now()
>
> Any advice on what I'm overlooking?  I searched
> through the MySQL manual for date datatypes, and
> couldn't find an answer to my problem.  Thank you.

You can't use functions in this statement, because LOAD DATA regards all
data
from the file as strings.



--
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Egor Egorov
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com




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







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