|
Posted by J.O. Aho on 10/04/58 11:39
Tony Peardon wrote:
> Its simple, really. I've got a table called name which holds, you guessed
> it, names. The fields are prefix, first, middle, last, and suffix. Only a
> persons first name need be included, as all other fields can be null, but I
> don't want them to be null by default. I want them set to an empty string by
> default instead. Null will be used to signify that a person does not have
> part of the name, while the empty string will signify only that the database
> doesn't yet know the information. I know this is easy, but I'm doing
> something wrong. Could someone please clear this up for me.
>
> Here's a line of relevant code...
>
> alter table name add column suffix varchar(5) null default('');
ALTER TABLE name ADD suffix VARCHAR(5) DEFAULT '';
> so what is the matter with that?
>
> also, assuming that suffix already exists within table name, what would the
> sql be to just add a default to it?
ALTER TABLE name MODIFY suffix VARCHAR(5) DEFAULT '';
http://dev.mysql.com/doc/refman/5.0/en/alter-table.html
//Aho
Navigation:
[Reply to this message]
|