Page 1 of 1

[SOLVED] Code for ALTER TABLE

Posted: Tue Feb 10, 2004 2:55 pm
by tstimple
Can somone tell me what the syntax is for using an ALTER TABLE command to set a mySQL column type to be BINARY?

Can you do it the same way you set a type to be an INTEGER, for example...

If the column field name is column1,

I've tried:
"ALTER TABLE CHANGE column1 column1 BINARY"

Doesn't seem to wotk

thanks,

--Tim

Posted: Tue Feb 10, 2004 3:03 pm
by DuFF
"ALTER TABLE `[table_name]` CHANGE `[current_field_name]` `[new_field_name]` [new_type]( [new_length/value] ) BINARY";

For Example:

Code: Select all

ALTER TABLE `cache` CHANGE `mod_title` `mod_title2` VARCHAR( 30 ) BINARY NOT NULL

Posted: Tue Feb 10, 2004 4:04 pm
by tstimple
Thanks,

I did not know I had to declare the number of characters and NULL or NOT NULL.

Works Great now

Thanks Again,

--Tim