--- Stefan Finzel <[EMAIL PROTECTED]> wrote:

> Yeah! I've missed the default option. But is this SQL standard?
> 
> And it does not seem to work for me at all. I still can't differ
> empty  and NULL; 
> create table deftest (k integer primary key,
>                       i integer default 'NULL',
>                       s char default 'NULL');
> 
> sqlite> insert into deftest (i, s) values (NULL,'');
> sqlite> select * from deftest;
> 1||
> sqlite>

NULL is what you get when "nothing was entered for that column".
NULL isn't equal to anything, because it's "nothing". Clear as mud? ;)

This statement:
      insert into deftest (i, s) values (NULL,'');
puts NULL into column i, because you explicitly
said that's what it should do. The default value is not used
because you provided a value.

You probably wanted this:
      insert into deftest (s) values ('');
You should get something like this as a result:
> sqlite> select * from deftest;
> 1|NULL|
> sqlite>

Note: You put the string 'NULL' as the default, this is NOT
the same as the value NULL.

If you want to find rows with NULL do something like this:
     select * from deftest where i IS NULL;

This:
     select * from deftest where i = NULL;
Should not work





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

You a Gamer? If you're near Kansas City, ask me about the Recruits and Conquest 
conventions.
---------------------------------

The Castles of Dereth Calendar: a tour of the art and architecture of Asheron's 
Call
http://www.lulu.com/content/77264


                
__________________________________ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 

Reply via email to