Load Data Infile keep giving the first record even the .csv file change or deleted via /r/learnprogramming


Load Data Infile keep giving the first record even the .csv file change or deleted

I use phpmyadmin and try to change the date on csv format to mysql format. Everything gone well. But, I realize that, when I change the CSV file with new records (or even delete it from the folder), this code keep give me the first record I test.

For example, the first time I run this code, my CSV file has 17 records. Then I update it to 30 records (or even delete this file), the code keep give me the 17 files in MySQL, instead of 30 files or error message (when I delete it).

Here is the SQL code:

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

Anyone know what is the problem?

Submitted July 13, 2017 at 03:41AM by epstanza
via reddit http://ift.tt/2ulxzUI

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