I have a column that is currently varchar(100)
and I want to make it 10000
.
is it as simple as
alter table table_name set
For me this has worked-
ALTER TABLE table_name ALTER COLUMN column_name VARCHAR(50)
use this syntax: alter table table_name modify column col_name varchar (10000);
I'd like explain the different alter table syntaxes - See the MySQL documentation
For adding/removing defaults on a column:
ALTER TABLE table_name
ALTER COLUMN col_name {SET DEFAULT literal | DROP DEFAULT}
For renaming a column, changing it's data type and optionally changing the column order:
ALTER TABLE table_name
CHANGE [COLUMN] old_col_name new_col_name column_definition
[FIRST|AFTER col_name]
For changing a column's data type and optionally changing the column order:
ALTER TABLE table_name
MODIFY [COLUMN] col_name column_definition
[FIRST | AFTER col_name]
For me worked this one:
ALTER TABLE tablename MODIFY fieldname VARCHAR(128) NOT NULL;
I am using mysql and below syntax worked well for me,
ALTER TABLE table_name MODIFY col_name VARCHAR(12);
I normally use this statement:
ALTER TABLE `table_name`
CHANGE COLUMN `col_name` `col_name` VARCHAR(10000);
But, I think SET will work too, never have tried it. :)