Exporting table contain ‘date’ field from access to csv via /r/learnprogramming


Exporting table contain ‘date’ field from access to csv

I have a table that contain date in access, but the data type is number (double) and the format is m/d/yyyy (not short date, general date, etc). When I try to export it out as .csv file, the format is change into 5 digit numbers. So, for example 12/12/2016 become 42716, while 7/12/2016 become 42711. The problem is, I want to import this table to MySQL with this following SQL script:

LOAD DATA INFILE 'file.csv' INTO TABLE customer FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n' ( ID, name, @var1, age ) SET date = STR_TO_DATE(@var1, '%d/%m/%Y') 

This script works well if the date format is still fine. But, if it is changed into those digit numbers, it is not work. Any idea how to handle this problem?

Submitted July 14, 2017 at 05:00AM by epstanza
via reddit http://ift.tt/2um20JA

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s