Re: SQL query for NULL field entries
Posted in 1992
Topics: SQL Development & Query Writing
This posting is for someone else, please reply to the address below:
caulds%deh1@redstone-emh2.army.mil (Charles Aulds /AMSMI-RA-EH-RM/876-0889) writes:
: What I want to do is select records where a specific field contains
: no entry. The following line does NOT work, but will illustrate what
: I need to do:
:
: select jocpbc.* from jocpbc where pbcj=" ";
:
If by "no entry" you mean "null", then space(s) is a valid non-null
value for a character field and should not be expected to work in the
manor you are indicating.
: The following line also fails to return the desired rows:
:
: select jocpbc.* from jocpbc where pbcj="";
:
: The column 'pbcj' is type character, but I need the query to work as
: well for date columns.
Try the following:
select * from jocpbc where pbcj is null;
Ron Whiteleather, ronw@salmon.boi.hp.com