I'm trying to copy a VARCHAR column into a DATE column with the following:
memberScores SET tempDate = STR_TO_DATE(eventDate,%d-%m-%Y) WHERE scoreID < 68010;
The error message that I receive is this:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%d-%m-%Y) WHERE scoreID < 68010' at line 1
The VARCHAR data in the eventDate column is in the format of 1-15-2010
I've tried several variations on this, such as the following:
memberScores
SET tempDate
= STR_TO_DATE(eventDate
,%d-%m-%Y) WHERE scoreID
< 68010;
INTO memberScores
.tempDate
SELECT STR_TO_DATE(memberScores
.eventDate
,%d-%m-%Y) WHERE memberScores
.scoreID
< 68010;
I did find https://dba.stackexchange.com/questions/202627/incorrect-value-for-str-to-date and I initially thought the answer there was relevant because I'm using Alma Linux (similar to Centos) and the STR_TO_DATE function where the time component was zero... but the fix there didn't work.
MySQL version is 8.0 on Alma Linux 8.7.0
Any ideas?
EDIT - Added the exact error message.
Asked by Eric Brockway
(21 rep)
Apr 29, 2023, 11:29 AM
Last activity: Apr 29, 2023, 11:45 AM
Last activity: Apr 29, 2023, 11:45 AM