views:

112

answers:

2

A show create table command shows the following:

'columnA' varchar(6) NOT NULL DEFAULT '';

How do I modify that column so that the not null is removed? I need it to be:

'columnA' varchar(6) DEFAULT NULL;

I thought the following would work, but it has no effect:

ALTER TABLE tbl_name MODIFY columnA varchar(6) DEFAULT NULL;
+4  A: 

Try this instead:

ALTER TABLE tbl_name MODIFY columnA varchar(6) NULL DEFAULT NULL; 
Eric Petroelje
Didn't make a difference.
Will
@Will: Works for me on 5.1.35 - what error are you getting?
OMG Ponies
No error. Query ok, 0 rows affected. 0 records, 0 duplicates, 0 warnings.
Will
A: 

Make the change (locally) in phpMyAdmin. It will show the query it used for the change.

Execute this query in production and you're done

Bob Fanger