Tim McQueen wrote:
> I'm having problems assigning default values when I create a table. For instance, if
> I have a table:
>
> create table foo (
> user char(16) NOT NULL,
> passwd char(16) DEFAULT 'password' NOT NULL,
> PRIMARY KEY (user)
> );
>
> and INSERT the values ('joeuser','')
>
> shouldn't it populate the table with the values ('tmcqueen','password') ?
>
> Thanks in advance for any help.
>
> Tim McQueen
> tmcqueen@stripped
You're explicity inserting an empty string (''), which MySQL is using instead of the
default.
To get it to use the default, don't name the passwd column in your insert. e.g.:
insert into foo (user) values ('joeuser')
See section 7.13 of the manual.
Regards,
--
Dan Koch
Webmaster
American City Business Journals
http://www.amcity.com/