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

SELECT Null Fields

Status
Not open for further replies.

accconst

IS-IT--Management
Oct 4, 2003
33
US
I am using ASP pasges to querey a SQL database. I want to create a record set that will return all rows in which the job_close_dt field is null. This is my current code:

sql = "SELECT * FROM JCJobs "
set rsJobs = Server.CreateObject("ADODB.Recordset")
rsJobs.Open sql, conn, 3, 3

How do I modify this to achieve what I have described?

Thanks!
 
sql = "SELECT * FROM JCJobs where job_close_dt is null"

[thumbsup2]DreX
aKa - Robert
 
hmmm .. *scratches head* might be "=" instead of "is"

been a long morning, although i think either will work


[thumbsup2]DreX
aKa - Robert
 
Try this:

sql = "SELECT * FROM JCJobs WHERE ISNULL(job_close_dt) OR job_close_dt="" "

-VJ
 
It's "IS NULL" for SQLServer. ISNULL is a SQLServerfunction:

ISNULL ( check_expression , replacement_value )
 
Sure. :) After making that mistake several hundred times I think I finally got it.
 
DreXor, your solution worked. Thanks so much!

Solution:
sql = "SELECT * FROM JCJobs where job_close_dt is null
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top