On Sun, 29 Aug 2004 22:26:25 +0100, Tim Bunce <[EMAIL PROTECTED]> wrote:
> Do any databases support CREATE TABLE statement with fields
> having a DEFAULT clause without a NOT NULL?
>... 
>         INSERT INTO foo (bar, baz) VALUES (1, NULL)
> 
> doesn't trigger the DEFAULT, but that
> 
>         INSERT INTO foo (bar) VALUES (1)

This is how MS SQL Server acts:

  CREATE TABLE create_default ( id int not null, def int default 42 );
  insert into create_default ( id ) values ( 1 );
  insert into create_default values ( 2, null );

results in:

  SELECT * FROM create_default;

  id     def
  ----   ----
  1      42
  2      NULL

Chris

-- 
Chris Winters ([EMAIL PROTECTED])
Building enterprise-capable snack solutions since 1988.

Reply via email to