MySQL Forums
Forum List  »  MySQL for Excel

LOAD DATA LOCAL INFILE, but only if the Snapshot date isn't the CURDATE
Posted by: J P
Date: May 10, 2017 07:44AM

SELECT
SNAPSHOT
FROM
db1.2017_projects
IF Max(SNAPSHOT) = CURDATE() THEN
EXIT
ELSE
LOAD DATA LOCAL INFILE '/\\\ant\\Projects Modified.csv' INTO TABLE db1.2017_projects FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '""' LINES TERMINATED BY '\r\n' IGNORE 1 LINES

I have tried a few different versions of an IF statement here, but I can't seem to get anything to work. This was my latest attempt.

I have a column in the table that contains a snapshot date, that snapshot date is once a week and is always Monday. There are times where the automation that uploads the data gets run more than once to fix errors with other loads.

I am trying to write this so that if the load has happened for the day it doesn't append the data again causing duplication. I have other automation in vba that prevents the file from even being uploaded if the file date isn't that day, so duplication on other days is not an issue.

Can MySQL do what I need? I can't seem to find anything with google, but I may just not be searching the correct things.

Options: ReplyQuote


Subject
Views
Written By
Posted
LOAD DATA LOCAL INFILE, but only if the Snapshot date isn't the CURDATE
192
J P
May 10, 2017 07:44AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.