Good morning,
I am loading information from a txt file and, in doing so, I want to format all the variables in a column.
In particular, I am in charge of DATETIME information, which comes as a string, and I want to give it the correct format so that it is saved well.
I try to do it with a STR_TO_DATE, but it does not load the information well.
Full mySQL code (variable in column 5):
LOAD DATA LOCAL INFILE
'in/trazas.txt'
INTO TABLE vn_gmstrazas
COLUMNS TERMINATED BY ';'
LINES TERMINATED BY '\n'
(@col1,@col2,@col3,@col4,@col5,@col6,@col7)
SET num = @col1, destino = @col2, referencia = @col3, estado = @col4, fecha = STR_TO_DATE(@col5, '%Y-%m-%d %H:%i:%s'), intento = @col6, refweb = @col7;
File that is loaded (example of a line):
1;99987984651;;Confirmado;22/12/2017 10:36:00;1;171222W02E2497_1.txt
How can I do it?
Thank you very much !!