Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why won't this work...

Status
Not open for further replies.

simian336

Programmer
Sep 16, 2009
723
US
I have a temp table defined as

Create Table #syspreftest (
[name] varchar(255),
PreferenceValue varchar(300),
isdisabled char(1),
ItemNum char(5),
ItemDesc varchar(200)
)

I have a query that works which looks like

select preferencevalue
from #syspreftest
where isdisabled = '1'
order by preferencevalue

This also works...

select preferencevalue
from #syspreftest
where isdisabled is null
order by preferencevalue

Why won't this work...

select preferencevalue
from #syspreftest
where isdisabled <> '1'
order by preferencevalue

it just returns blanks.. (btw only 2 rows have '1' the rest don't)

Thanks

Simi
 
Nulls can not be equated to anything.

Try

select preferencevalue
from #syspreftest
where isdisabled is null or isdisabled <> '1'
order by preferencevalue

Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top