Null from AS/400

  • Thread starter Thread starter Rob T
  • Start date Start date
R

Rob T

Changes of anyone experiencing this is slim, but it's worth a shot
asking....

I'm using ODBC to connect to an AS/400 and have no problem querying it. My
problem is that when I do a left join on a table that may return null
values, I cannot pass the criteria "is null" or "= null". When I add this
criteria, the program bombs stating this: "ERROR [42000] [IBM]{Client
Access Express ODBC Driver (32-bit)][DB2/400 SQL]SQL0128 - Use of NULL is
not valid"

So, How do I check for a null value?

Below is a crude example of how the join should work.

Select * from myTable1 left join myTable1 on (myTable1.col1=myTable2.col2)
where myTable2.stuff is null

Any suggestions? Thanks!

-Rob T.

PS. sorry for the cross post...I was hoping someone in ado may have an
idea....
 
Rob,
How are you constructing the string that you are passing to the AS/400.

Are you using parameters?

How are you setting the values of those parameters?

Generally if I want to always include "myTable2.stuff is null" in my query,
I include it in the query.

Hope this helps
Jay
 
Thanks for the feedback. Come to find out (after pulling out my hair), that
for some reason, the 400 needs null to be upper case!!! I don't know if
it's a bug with the ODBC driver or something in the 400. I hate wasting my
time debugging other people's bugs!!!!!!


Jay B. Harlow said:
Rob,
How are you constructing the string that you are passing to the AS/400.

Are you using parameters?

How are you setting the values of those parameters?

Generally if I want to always include "myTable2.stuff is null" in my query,
I include it in the query.

Hope this helps
Jay


Rob T said:
Changes of anyone experiencing this is slim, but it's worth a shot
asking....

I'm using ODBC to connect to an AS/400 and have no problem querying it. My
problem is that when I do a left join on a table that may return null
values, I cannot pass the criteria "is null" or "= null". When I add this
criteria, the program bombs stating this: "ERROR [42000] [IBM]{Client
Access Express ODBC Driver (32-bit)][DB2/400 SQL]SQL0128 - Use of NULL is
not valid"

So, How do I check for a null value?

Below is a crude example of how the join should work.

Select * from myTable1 left join myTable1 on (myTable1.col1=myTable2.col2)
where myTable2.stuff is null

Any suggestions? Thanks!

-Rob T.

PS. sorry for the cross post...I was hoping someone in ado may have an
idea....
 
Back
Top