That's not how it works.  The following demonstrates the feature I think
you want.

>mysql test
test> create table testnull ( X varchar(10) not null );
Query OK, 0 rows affected (0.11 sec)

test> insert into testnull values ( null );
ERROR 1048: Column 'X' cannot be null
test>

> -----Original Message-----
> From: mos [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, October 28, 2003 1:50 PM
> To: [EMAIL PROTECTED]
> Subject: How to define a required field in a table?
> 
> 
> Is it possible to define required fields in a MySQL table?
> By that I mean if the row is updated and the field value is 
> still null, the 
> update for the row is rejected and an error is produced.
> 
> The "NOT NULL" clause in the table definition simply converts 
> NULL values 
> to '' or zero for string and numeric fields. This only makes 
> things worse 
> because now it is harder to spot invalid data because the 
> zeroes and '' 
> blends in with valid data.
> 
> So I need the update to fail so I can keep invalid data 
> (NULL's) out of the 
> table. Any idea on how to do this? TIA
> 
> Mike
> 
> 
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    
> http://lists.mysql.com/mysql?> [EMAIL PROTECTED]
> 
> 


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to