At 5:52 PM +0100 2000-01-29, Fernando RodrÌguez wrote:
> > -----Mensaje original-----
>> De: sinisa@stripped [mailto:sinisa@stripped]
>> Enviado el: sábado, 29 de enero de 2000 16:14
>> Para: frr@stripped
>> CC: mysql@stripped
>> Asunto: Re: Adding elements to a enum field
>>
>>
>> Fernando Rodríguez writes:
>> > Hi!
>> >
>> > Can I add elements to an enum field without having to
>> rebuild the database? O:-)
>> >
>> > 'Fernando
>>
>>
>> HI!
>>
>> If you want to add another entry item in ENUM field, you only have to
>> ALTER a table containing that column.
>>
> No, what I mean is:
>
>a) I have an enum ('home', 'work', 'beeper')
>b) I want to chnage it to enum('home', 'work', 'beeper',
>'private-jet', 'island')
>O:-)
Sinisa's answer is exactly correct. You want to use ALTER TABLE to
change the definition of the column in question.
ALTER TABLE tbl_name
CHANGE col_name col_name ENUM('home', 'work', 'beeper',
'private-jet', 'island')
Note that you repeat col_name. If your version of MySQL supports MODIFY
and you're not renaming the column, you can use:
ALTER TABLE tbl_name
MODIFY col_name ENUM('home', 'work', 'beeper', 'private-jet', 'island')
--
Paul DuBois, paul@stripped