views:

9

answers:

1

I am running MySQL and I need to change the data type of certain columns from an enumeration to integer. However, there are a lot of columns. (If this exists) What is the syntax to alter all columns at the same time that are enumerations. Here is how I am updating a single column to make it integer data type:

ALTER TABLE table_name CHANGE column_name column_name INTEGER;

A: 

SHOW COLUMNS FROM WHERE TYPE LIKE "%enum%"

you could afterwards iterate through your result similar to the solution described here: http://se2.php.net/manual/en/function.mysql-fetch-field.php#92069 hope this helps, Michael

michael