dbTalk Databases Forums  

Sql Question

comp.databases.ibm-db2 comp.databases.ibm-db2


Discuss Sql Question in the comp.databases.ibm-db2 forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Kiavik
 
Posts: n/a

Default Sql Question - 08-26-2003 , 03:28 AM






Hello All

I have a problem with an SQL query. The query is quite simple cause i need
to get all the rows of a table which have a field set to null.

For exaple consider this table:

CUSTOMERS
----------------------------------------
NAME | SECOND_NAME | LAST_NAME | ADDRESS
----------------------------------------

I need to geet all the customers which have SECOND_NAME set to NULL.

I tried something like this:

SELECT * FROM CUSTOMERS
WHERE SECOND_NAME=NULL;

But the DB2 gives me an error: "NULL is invalind in the context it is used"

How can I select all the rows which have second name null?

Thanks

--
Nel tempo dell'inganno universale
dire la verità è un atto rivoluzionario
(George Orwell)


ICQ:61810110
YAHOO!:Kiavick

Reply With Quote
  #2  
Old   
Anton Versteeg
 
Posts: n/a

Default Re: Sql Question - 08-26-2003 , 05:14 AM






try:

WHERE SECOND_NAME is NULL

Kiavik wrote:

Quote:
Hello All

I have a problem with an SQL query. The query is quite simple cause i need
to get all the rows of a table which have a field set to null.

For exaple consider this table:

CUSTOMERS
----------------------------------------
NAME | SECOND_NAME | LAST_NAME | ADDRESS
----------------------------------------

I need to geet all the customers which have SECOND_NAME set to NULL.

I tried something like this:

SELECT * FROM CUSTOMERS
WHERE SECOND_NAME=NULL;

But the DB2 gives me an error: "NULL is invalind in the context it is used"

How can I select all the rows which have second name null?

Thanks



--
Anton Versteeg
IBM Certified DB2 Specialist
IBM Netherlands




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.