Page 1 of 1

LOAD DATA INFILE & Timestamp Question

Posted: Fri Feb 20, 2004 6:31 pm
by rxsid
Hi all,

Im loading some data into a MySQL db v 3.23.55 on winNT box, from a .csv file using LOAD DATA INFILE.

Everything is working perfect, except for trying to get my last column in the table, which is a Timestamp(14) column, to display the timestamp for which the data was loaded. All Zero's (0) are being displayed.

According to the MySQL site
[quote]
TIMESTAMP columns are set to the current date and time only if there is a NULL value for the column (that is, \N), or (for the first TIMESTAMP column only) if the TIMESTAMP column is omitted from the field list when a field list is specified.
[\quote]

So, I am loading the last cell value as a null or "". I've also tried "\n" which doesn't work either. The last cell value in the .csv should correspond to my last MySQL timestamp column type. I just can't seem to get anything but 0's to be displayed in mysql.

Any ideas?

Thanks.

Posted: Sun Feb 22, 2004 10:21 am
by tsg
Try changing from timestamp to TIME or DATETIME and see if that helps (depending on the format).

If not, maybe change it to VARCHAR to get it uploaded, then change back to timestamp.

Don't know if either will work, but just a suggestion.

Tim

Posted: Mon Feb 23, 2004 12:32 pm
by rxsid
ok...i've found the issue.
i forgot a date character for seconds (for the .cvs data in the cell corresponding to the timestamp column):

Code: Select all

//had
date("YmdHi");

//revised
date("YmdHis");
?>

now it works :)