By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,383 Members | 2,063 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,383 IT Pros & Developers. It's quick & easy.

Check for Null

P: n/a
Is there an easier way to check if any of the fields returned in a
select statement have null values?

After running this command:

set rs = conn.execute("select A,B,C,D,E,F,G,H,I,J from SomeTable
where...")

I could check each field this way:

If IsNull(rs("A") Then
Response.Write("The value of A is null")
Else
Response.Write("The value of A is " & rs("A"))
End If

If IsNull(rs("B") Then
Response.Write("The value of B is null")
Else
Response.Write("The value of B is " & rs("B"))
End If

If IsNull(rs("C") Then
Response.Write("The value of C is null")
Else
Response.Write("The value of C is " & rs("C"))
End If

etc.

But is there a simpler way?

Also, my "solution" probably wouldn't work if more than one recordset
was returned...
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
use a null replacement in your SQL statement - I don't kow what DB you are
working with...

an oracle example: set rs = conn.execute("select NVL(A,'IsNull') AS A, ...
from SomeTable where...")
an SQL server example: set rs = conn.execute("select ISNULL(A,'IsNull') AS
A, ... from SomeTable where...")
"Luis" <an**********@webmail.co.za> wrote in message
news:u1****************@TK2MSFTNGP12.phx.gbl...
Is there an easier way to check if any of the fields returned in a
select statement have null values?

After running this command:

set rs = conn.execute("select A,B,C,D,E,F,G,H,I,J from SomeTable
where...")

I could check each field this way:

If IsNull(rs("A") Then
Response.Write("The value of A is null")
Else
Response.Write("The value of A is " & rs("A"))
End If

If IsNull(rs("B") Then
Response.Write("The value of B is null")
Else
Response.Write("The value of B is " & rs("B"))
End If

If IsNull(rs("C") Then
Response.Write("The value of C is null")
Else
Response.Write("The value of C is " & rs("C"))
End If

etc.

But is there a simpler way?

Also, my "solution" probably wouldn't work if more than one recordset
was returned...
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.