?
Solved

ASP/ADO bug with SQLserver

Posted on 1998-08-13
4
Medium Priority
?
225 Views
Last Modified: 2010-03-19
Im creating a recordset from ASP with the following query (the recorset type is forward only, no lock, textual command);

SELECT *  FROM core WHERE empvis != null AND eNews=1

eNews is a bit datatype and empvis is datetime (with nulls) . When I run it from ASP, it returns nothing, yet running from the SQL tool in Enterprise manager it returns lots (what I want). If I remove the eNews=1 bit then I do get data returned via ASP. Is this an ADO bug - any workarounds?

Matthew Allum
0
Comment
Question by:matthewallum
  • 2
4 Comments
 
LVL 2

Expert Comment

by:Wiz_of_Oz
ID: 1089546
what r the results of the qry
SELECT * FROM core
r they correct?
0
 

Author Comment

by:matthewallum
ID: 1089547
yep
0
 
LVL 4

Accepted Solution

by:
mitek earned 200 total points
ID: 1089548
Of course, it will return nothing. It's not a bug in ASP/ADO, but a bug in the query.
Instead of writing
SELECT *  FROM core WHERE empvis != null AND eNews=1 ,
try
SELECT *  FROM core WHERE empvis IS NOT null AND eNews=1

Your query is not supposed to return anything, because any comparison ( =, !=, >, <) to null will render FALSE value.
Thus, the whole expression is false and no rows are selected.
 
0
 

Author Comment

by:matthewallum
ID: 1089549
Thanks ! makes sense now and works ;)
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question