Thread: boolean

boolean

From
"Henrik Steffen"
Date:
hello list,

if i have a table foo with a column called bar of type boolean
and if i insert into foo (foobar) values('bar') without
explicitly inserting a value for bar, the bar column of this
particular row will be empty. it's neither 't' nor 'f'.

i can select all rows where bar eqals to 't' and all
rows where bar equals to 'f'.

But I want to know, how I can select all rows which neither
match 't' nor 'f' ? To perform an update like

UPDATE foo SET bar='t' WHERE bar=null;

or anything similar. What syntax can I use?

thanks for your help

Mit freundlichem Gruß

Henrik Steffen
Geschäftsführer

top concepts Internetmarketing GmbH
Am Steinkamp 7 - D-21684 Stade - Germany
--------------------------------------------------------
http://www.topconcepts.com          Tel. +49 4141 991230
mail: steffen@topconcepts.com       Fax. +49 4141 991233
--------------------------------------------------------
24h-Support Hotline:  +49 1908 34697 (EUR 1.86/Min,topc)
--------------------------------------------------------
Ihr SMS-Gateway: JETZT NEU unter: http://sms.city-map.de
System-Partner gesucht: http://www.franchise.city-map.de
--------------------------------------------------------
Handelsregister: AG Stade HRB 5811 - UstId: DE 213645563
--------------------------------------------------------


Attachment

Re: boolean

From
Stephane Bortzmeyer
Date:
On Fri, Sep 20, 2002 at 02:49:25PM +0200,
 Henrik Steffen <steffen@city-map.de> wrote
 a message of 113 lines which said:

> and if i insert into foo (foobar) values('bar') without
> explicitly inserting a value for bar, the bar column of this
> particular row will be empty. it's neither 't' nor 'f'.

Actually, it will be NULL. Unless you add a constraint NOT NULL to the
column.

> But I want to know, how I can select all rows which neither
> match 't' nor 'f' ? To perform an update like
>
> UPDATE foo SET bar='t' WHERE bar=null;

... WHERE bar IS NULL;

(It is a common SQL problem, the handling of NULL values. Read any
book about SQL.)


Re: boolean

From
Holger Klawitter
Date:
> But I want to know, how I can select all rows which neither
> match 't' nor 'f' ?

"isnull" is the operator you need.

With kind regards / mit freundlichem Gruß
    Holger Klawitter
--
Holger Klawitter                          http://www.klawitter.de
lists@klawitter.de