MYSQL INSERT RUNTIME DATE CONVERSION Syntax Issue

Hi All,

I’m getting the below error when trying to insert a value dynamically from a datatable using foreach into mysqldb.
Below is the query i ‘ve used.
"INSERT INTO INPUT_TABLE (START_DATE) VALUES (STR_TO_DATE(@START_DATE,’%M %d %Y’)"

Could anyone please help me out?
image

Thanks in advance :slight_smile:

@Tanuja_Gopalasetti -
pls check the format of @Start_date and change the STR_TO_DATE format accordingly.
Ex: STR_TO_DATE(‘21,5,2013’,‘%d,%m,%Y’);
STR_TO_DATE(‘21-5-2013’,‘%d-%m-%Y’);

format should be ‘%d %m %Y’ or %m %d %Y (small d, small m, and caps Y)

@GBK, changed the values as you said. Still getting the same error.
could you please let me know if anything else needs to be changed?

Can you log the insert statement using log message activity and share it with us?

there could be a possibility of input data issue…

“INSERT INTO INPUT_TABLE (START_DATE) VALUES (STR_TO_DATE(@START_DATE,’%m %d %Y’)”