12/02/2002, 14:52
|
| | Fecha de Ingreso: noviembre-2001
Mensajes: 415
Antigüedad: 23 años, 2 meses Puntos: 0 | |
Re: Cambio de tipo de columna <pre>mysql> create table tabla (columna enum('1','2','3'));
Query OK, 0 rows affected (0.00 sec)
mysql> desc tabla;
+---------+-------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------------+------+-----+---------+-------+
| columna | enum('1','2','3') | YES | | NULL | |
+---------+-------------------+------+-----+---------+-------+
1 row in set (0.00 sec)
mysql> insert into tabla (columna) values ('1');
Query OK, 1 row affected (0.00 sec)
mysql> select * from tabla;
+---------+
| columna |
+---------+
| 1 |
+---------+
1 row in set (0.00 sec)
mysql> alter table tabla modify columna set('1','2','3');
Query OK, 1 row affected (0.00 sec)
Records: 1 Duplicates: 0 Warnings: 0
mysql> desc tabla;
+---------+------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+------------------+------+-----+---------+-------+
| columna | set('1','2','3') | YES | | NULL | |
+---------+------------------+------+-----+---------+-------+
1 row in set (0.00 sec)
mysql> select * from tabla;
+---------+
| columna |
+---------+
| 1 |
+---------+
1 row in set (0.00 sec)
mysql> </pre> |