Mega Code Archive

 
Categories / MySQL / Table Index
 

Use ALTER TABLE to change the column type

mysql> CREATE TABLE news     -> (     -> id INT UNSIGNED NOT NULL AUTO_INCREMENT,     -> article BLOB NOT NULL,     -> PRIMARY KEY (id)     -> ); Query OK, 0 rows affected (0.01 sec) mysql> mysql> ALTER TABLE news MODIFY article TEXT NOT NULL; Query OK, 0 rows affected (0.01 sec) Records: 0  Duplicates: 0  Warnings: 0 mysql> ALTER TABLE news CHANGE article article TEXT NOT NULL; Query OK, 0 rows affected (0.01 sec) Records: 0  Duplicates: 0  Warnings: 0 mysql> mysql> drop table news; Query OK, 0 rows affected (0.00 sec) mysql>