MySQL Forums
Forum List  »  Newbie

ALTER TABLE not working?
Posted by: Daniel Frey
Date: May 07, 2005 10:01AM

I have a table which I was trying to change the columns to. For some reason, mysql will not change the column from a varchar to a char type.

Table:

TABLE test {
fld1 varchar(20) not null unique
fld2 varchar(30) not null unique default 'default'
fld3 int(10) not null default 5
}

When I do (in mysql console or PHP):

ALTER TABLE `test` CHANGE `fld2` `fld2` CHAR(30) DEFAULT 'default' NOT NULL;

ALTER TABLE `test` CHANGE `fld1` `fld1` CHAR(20) NOT NULL

neither will change the column type to char; both columns remain as a varchar. It is doing something though, as if I change the default value in the first alter table statement, the new default gets set.

At first I thought it was because of the unique setting but it does this on both fields.

I'm using mysql 4.0.24. Does anyone know why I can't change these two column types? I have tested numeric types (i.e. bigint -> int) with alter tables and it works correctly ??

Options: ReplyQuote


Subject
Written By
Posted
ALTER TABLE not working?
May 07, 2005 10:01AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.