Ask a Question related to ASP Database, Design and Development.
-
Jacob #1
Null Values in a table not properly selected
I am using SQL Server 7.0. I have a table with a field called PARENT_ID,
which has a numerical value entered for those which have a logical parent,
and has an empty value for those that do not. I want to select the records
which have a PARENT_ID = '' (Parent_ID equal to nothing). The following
code, however, returns an empty set of results. Could somebody please point
out where the error lies in the code?
SELECT LOC_NAME, LOC_ID, PARENT_ID FROM SYS_LOCATIONS WHERE PARENT_ID = ''
I've also tried:
SELECT LOC_NAME, LOC_ID, PARENT_ID FROM SYS_LOCATIONS WHERE PARENT_ID = Null
Neither appear to be working correctly. Any help would be appreciated.
Thanks,
Jacob
Jacob Guest
-
#26288 [Opn->Fbk]: Segmentation Fault while getting NULL values from a row of a table
ID: 26288 Updated by: iliaa@php.net Reported By: kiranhariharan at in dot ibm dot com -Status: Open +Status: ... -
#26288 [Opn]: Segmentation Fault while getting NULL values from a row of a table
ID: 26288 User updated by: kiranhariharan at in dot ibm dot com Reported By: kiranhariharan at in dot ibm dot com Status: ... -
#26288 [Fbk->Opn]: Segmentation Fault while getting NULL values from a row of a table
ID: 26288 User updated by: kiranhariharan at in dot ibm dot com -Summary: Segmentation Fault while getting NULL values from... -
#26288 [Opn->Fbk]: Segmentation Fault while getting NULL values from a row of a table(PHP v 4.2.2)
ID: 26288 Updated by: iliaa@php.net Reported By: kiranhariharan at in dot ibm dot com -Status: Open +Status: ... -
Finding null values in a large table
I have a fairly large table (millions of rows) and I would like to be able to find rows that have a null value in a particular column. I know that... -
Marvin Thompson #2
Re: Null Values in a table not properly selected
What is the data type of parent_id? If it is numeric, then 0 is the value
when it is not set.
might also try
WHERE (PARENT_ID & '') = ''
This will handle the null or zero length values for PARENT_ID
"Jacob" <yak2016@comcast.net> wrote in message
news:%23am1fkwQDHA.2676@TK2MSFTNGP10.phx.gbl...records> I am using SQL Server 7.0. I have a table with a field called PARENT_ID,
> which has a numerical value entered for those which have a logical parent,
> and has an empty value for those that do not. I want to select thepoint> which have a PARENT_ID = '' (Parent_ID equal to nothing). The following
> code, however, returns an empty set of results. Could somebody pleaseNull> out where the error lies in the code?
>
> SELECT LOC_NAME, LOC_ID, PARENT_ID FROM SYS_LOCATIONS WHERE PARENT_ID = ''
>
> I've also tried:
>
> SELECT LOC_NAME, LOC_ID, PARENT_ID FROM SYS_LOCATIONS WHERE PARENT_ID =>
> Neither appear to be working correctly. Any help would be appreciated.
>
> Thanks,
> Jacob
>
>
Marvin Thompson Guest



Reply With Quote

