Monthly Archives: April 2023

Latin to UTF

In primul rand convertim DB:

ALTER DATABASE <DB_NAME> CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

Dupa asta convertim fiecare tabel in parte:

ALTER TABLE TBL1 CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE TBL2 CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

Daca este nevoie convertim campurile din tabel:

UPDATE <TABELA> SET
FLD1=convert(cast(convert(FLD1 using  latin1) as binary) using utf8),
FLD2=convert(cast(convert(FLD2 using  latin1) as binary) using utf8)
WHERE 1