After a few hours' study, it seems I must delete my column and create a new one in its place. Or am I missing the syntax to rename a column (preserving the data it holds)?
(MySQL 5)
thanks, everyone
After a few hours' study, it seems I must delete my column and create a new one in its place. Or am I missing the syntax to rename a column (preserving the data it holds)?
(MySQL 5)
thanks, everyone
I use PHPMYADMIN and that allows you to rename a field.
I opened the table, selected the field and chose the change/edit option.
The first value was the name of the field, I changed this and it preserved the data.
If I was to change the data type then I don't believe it would preserve the data.
Here is the SQL it generated:
Code:ALTER TABLE `table1` CHANGE `field1` `field2` VARCHAR( 30 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL
hey, cool... here I was, looking through every tutorial I could find, and I could've just opened up myadmin...
thanks, I'll try it out.
Check this out from the MySQL site http://dev.mysql.com/doc/refman/5.1/en/alter-table.html
Ryan
Sevierville, TN
Bookmarks