List:General Discussion« Previous MessageNext Message »
From:Scott Baker Date:May 9 2007 7:15pm
Subject:NOT NULL = Not Working?
View as plain text  
If I create the following table, and then try and insert the following
data both inserts work. It looks like the second one works (it shouldn't
because Last is NULL) because it assumes Last = ''. Is there a way I can
make it NOT assume that? If Last is not specified it should reject that
command. Is that possible?

---------------------------------------------------------------

DROP TABLE IF EXISTS foo;

CREATE TABLE foo (
   ID INTEGER PRIMARY KEY AUTO_INCREMENT,
   First VarChar(30),
   Last VarChar(30) NOT NULL,
   Zip INTEGER
);

INSERT INTO foo (First, Last, Zip) VALUES ('Jason','Doolis',97013);
INSERT INTO foo (Last) VALUES (17423);
Thread
NOT NULL = Not Working?Scott Baker9 May
  • Re: NOT NULL = Not Working?JamesDR9 May
    • Re: NOT NULL = Not Working?JamesDR9 May
      • Re: NOT NULL = Not Working?Scott Baker9 May
  • Re: NOT NULL = Not Working?Ricardo Conrado Serafim9 May