0

I want to change the collation of all my fields in a database. I can change by one at a time with this sentence:

UPDATE documentos2 SET titulo = CONVERT(BINARY CONVERT(titulo USING latin1) USING utf8)

I need a loop or similar to change all the database fields. Any idea?

Thanx!

1 Answers1

0

Terminology: utf8 is a CHARACTER SET, not a COLLATION.

It is unclear what problem you are trying to solve...

  • Perhaps you mistakenly stored utf8 characters in a latin1 field?
  • Perhaps you want to re-declare titulo as utf8? (That UPDATE will not achieve that; it will make a mess.)
  • Perhaps titulo is already declared utf8, but data was stored incorrectly?
  • Something else??

See Trouble with utf8 characters; what I see is not what I stored In particular, see the SELECT HEX... tip. Please provide the output from such, so we can figure out what got stored. Also provide SHOW CREATE TABLE documentos2 so we can know what titulo is currently declared as.

Community
  • 1
  • 1
Rick James
  • 135,179
  • 13
  • 127
  • 222