How To Find Column Character Set
Posted by: Thomas Taylor
Date: February 20, 2006 07:40PM

I have a large number of MySQL 4.1.7 databases that may have been installed with either default character set of 'latin1' or 'utf8'. I need to convert all of the text columns in the Latin1 installations to UTF-8. Ideally, I would only convert the Latin1 installations without converting UTF-8 installations.

Is there any way to discover the character set of a table column? So far, the only possibility I've found is to "SHOW CREATE TABLE" and search for the "DEFAULT CHARACTER SET XXX" at the end of the result. However, this only indicates the table's default character set and not the column's actual character set.

Any help would be appreciated.

TT

IF (GetCharacterSet(`MyTable`.`MyColumn`) != UTF-8) DO
ALTER TABLE `MyTable` CHANGE `MyColumn` BLOB;
ALTER TABLE `MyTable` CHANGE `MyColumn` LONGTEXT
CHARACTER SET utf8 COLLATE utf8_general_ci;
END IF

Options: ReplyQuote


Subject
Views
Written By
Posted
How To Find Column Character Set
11253
February 20, 2006 07:40PM
3719
February 20, 2006 08:57PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.