I have a huge bank in Latin1 and I need to convert ALL the values of ALL the columns of the bank.
Searching discovered a command that does this manually.
UPDATE tabela SET coluna = CONVERT(cast(CONVERT(coluna USING latin1) AS BINARY) USING utf8);
But the bank has a lot of tables and columns, so it is impractical to do the conversion manually, could you help me with some script that would bring this command up to all the columns in the bank?
Searching, I found this command that returns a conversion list of all tables, but it does not convert the columns that have already been created.
SELECT CONCAT('ALTER TABLE ', tbl.TABLE_SCHEMA, '.', tbl.TABLE_NAME, ' CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;')
FROM information_schema.TABLES tbl WHERE tbl.TABLE_SCHEMA = 'Sua_Base_de_Dados';