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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding a N to the front of a value in a query 1

Status
Not open for further replies.

synapsevampire

Programmer
Mar 23, 2002
20,180
US
Using SQL Server 2000

I assume that some database setting is causing this, but when I issue a query of:

select directrep from table
where directrep <> 'Blah"

it eliminates the nulls for that column as well.

I test this by using:

select count(*)
from
(
select directrep from table
where directrep <> 'Blah"
) A
where directrep is null

And I get zero, but if I use:

select count(*) from table
where directrep is null

I get 300,000 rows.

Is there some setting which causes this odd behavior?

-k
 
I love the name of that article Dennis.

Questions about posting. See faq183-874
 
Interesting, but it doesn't quite resolve.

Any idea why the query gets preceded by a N, in the example of:

select directrep from table
where directrep <> N'Blah"

-k
 
I see, so it has no impact on the resultset, it's required for those data types?

How can I use a single query and filter only for specific values and NOT filter out the nulls?

Is there a setting?

-k
 
Ahhh, I see, so there isn't a way without explicitly stating to allow the nulls, thanks.

I had hoped there was a setting.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top