 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Kim Hellan Guest
|
Posted: Fri Sep 15, 2006 8:10 am Post subject: Paradox table and NULL values |
|
|
I'm having a little problem understanding when a record with a NULL value is
returned, if you query the field where that NULL value is.
An example...
I have a small table with the 3 columns (COL1, COL2, COL3) and the following
field values in the three records:
1- "New York", "East","Hello"
2- "Miami",<NULL>,"Just testing"
3- "Los Angeles", "West","Last record here"
If I do a
SELECT * FROM mytable WHERE COL2<>'West'
I only get record 1 back which I expect since COL2 in record 2 is undefined
(NULL).
But if I do a
SELECT * FROM mytable WHERE COL2=''
I get record 2 back, so in this case field 2 is not counted as an undefined
value, but as an empty string.
Why is record 2 returned in the second SQL statement?
Any help/hints appreciated.
Regards,
Kim |
|
| Back to top |
|
 |
Jayme Jeffman Guest
|
Posted: Sun Sep 17, 2006 2:56 am Post subject: Re: Paradox table and NULL values |
|
|
Hello,
I do not know how Borland has implemented the Local SQL feature
of BDE or DB Express.
It might not be able to deal with null values and an empty string *is* a
null value for this data type.
I think, as the column "col2" of your table allow null values, you should
add a "OR COL2 IS NULL" where clause to include those records that
have not been retrieved.
HTH
Jayme.
"Kim Hellan" <someone (AT) nowhere (DOT) com> escreveu na mensagem
news:450a521c$1 (AT) newsgroups (DOT) borland.com...
| Quote: | I'm having a little problem understanding when a record with a NULL value
is returned, if you query the field where that NULL value is.
An example...
I have a small table with the 3 columns (COL1, COL2, COL3) and the
following field values in the three records:
1- "New York", "East","Hello"
2- "Miami",<NULL>,"Just testing"
3- "Los Angeles", "West","Last record here"
If I do a
SELECT * FROM mytable WHERE COL2<>'West'
I only get record 1 back which I expect since COL2 in record 2 is
undefined (NULL).
But if I do a
SELECT * FROM mytable WHERE COL2=''
I get record 2 back, so in this case field 2 is not counted as an
undefined value, but as an empty string.
Why is record 2 returned in the second SQL statement?
Any help/hints appreciated.
Regards,
Kim
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|