Jochem van Dieten wrote:
> Barney Boisvert wrote:
> > Where did you hear that one Jochem? MySQL enforces NOT NULL just fine.
Jochem and Barney - you're both right.. and wrong, it seems.
MySQL absolutely does enforce NOT NULL attributes. You cannot insert a
NULL value into a field specified as NOT NULL.
HOWEVER, it automatically assigns a default value for all fields. So if
you don't include the field in an INSERT Query, the default value will
be used. I *THINK* this behavior differs from other databases that I've
worked with.
For example... let's take a table definition that looks like this:
CREATE TABLE TESTING
(
RecordID int not null,
SomeValue varchar(255) not null
);
MySQL does set defaults for each... so these queries will both work:
INSERT INTO TESTING ( RecordID ) VALUES ( 1 );
INSERT INTO TESTING ( SomeValue ) VALUES ( 'bork' );
But these queries will NOT:
INSERT INTO TESTING VALUES ( NULL, 'bork' );
INSERT INTO TESTING VALUES ( 1, NULL );
INSERT INTO TESTING VALUES ( NULL, NULL )
- Rick
[Todays Threads]
[This Message]
[Subscription]
[Fast Unsubscribe]
[User Settings]
- Debugging CFQUERYPARAM Rick Root
- RE: Debugging CFQUERYPARAM Tom Kitta
- Re: Debugging CFQUERYPARAM Rick Root
- Re: Debugging CFQUERYPARAM Charlie Griefer
- Re: Debugging CFQUERYPARAM Jochem van Dieten
- Re: Debugging CFQUERYPARAM Charlie Griefer
- RE: Debugging CFQUERYPARAM Barney Boisvert
- Re: Debugging CFQUERYPARAM Jochem van Dieten
- Re: Debugging CFQUERYPARAM Rick Root
- Re: Debugging CFQUERYPARAM Rick Root
- Re: Debugging CFQUERYPARAM Charlie Griefer
- RE: Debugging CFQUERYPARAM Barney Boisvert
- Re: Debugging CFQUERYPARAM Charlie Griefer
- Re: Debugging CFQUERYPARAM Rick Root
- Re: Debugging CFQUERYPARAM Jochem van Dieten
- RE: Debugging CFQUERYPARAM Tom Kitta
- RE: Debugging CFQUERYPARAM Ian Skinner