0
I am updating a table in a bank with more than 100 thousand records to be able to perform future SELECTS to generate a statistical report.
The table currently has a 'Birth' column of type varchar(10) which stores the customer’s date of birth in the format 'dd/mm/yyyy'. As in varchar is taking about 2 minutes to complete the query.
So I created a column called 'data_nascimento' of the date type and I’m trying to use the following code to convert the values of the 'Birth' column':
update cadastros_dados set data_nascimento = STR_TO_DATE(nascimento,'%d%m%Y')
But it makes the following mistake:
[Err] 1411 - Incorrect datetime value: '23/02/1971' for Function str_to_date
Why are you not accepting the date that is stored in 'Birth' in the STR_TO_DATE function? What am I doing wrong?
I already put with the bars but still gives the following error:
– WitnessTruth
[Err] 1411 - Incorrect datetime value: '20 01 1958' for Function str_to_date
– WitnessTruth
I found the problem. Some records are dd/mm/yy and others are dd mm yyyy. Would there be some way I could update all these incorrect without having to be one by one?
– WitnessTruth
gives a replace, where it has spaces /
– Rovann Linhalis
@Renankaiclopes if helped you, do not forget to mark as reply. thanks
– Rovann Linhalis