[thelist] Testing for the various NULL's (Result!)
Ken Schaefer
ken at adOpenStatic.com
Sat Dec 7 03:23:01 CST 2002
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Rob Smith" <rob.smith at THERMON.com>
Subject: RE: [thelist] Testing for the various NULL's (Result!)
: After fighting with my computer a bit and maintaining a few bruises, I
have
: the solution!
:
: if Left(commercial_region,1) <> " " then
: if not commercial_region = "" then
: response.write(commercial_region)
: end if
: end if
:
: What's even more weird is that these tests failed when on the same line
: separated by an OR. They where however, successful as you see them here,
on
: different lines.
:
: The left was to test for left over residue from existing data that was
just
: deleted, not NULL'ed. The not = "" successfully tested for the actual
: "<Null>" value we're so familiar with in SQL Server.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Rob,
With the greatest respect, if you're using a test like this:
<%
commercial_region = ""
%>
to detect a "NULL", then you don't have a NULL in your database. You have a
Zero Length String, and everything that Rudy (and others) has pointed out
about NULLs has gone straight over you head.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: if not something = NULL then didn't work
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Will always be true...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: if something = NULL then didn't work
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Will always be false
...so one of these must have run the code you wanted, even if it wasn't for
the reasons that you wanted. Likewise with:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: if IsNull(something) then didn't work
: if not IsNull(something) then didn't work
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
and lastly, as pointed out before:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: if not something is NULL then didn't work
: if something is NULL then didn't work
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
isn't valid VBScript in the first place. You'd get some kind of compiler
error.
Cheers
Ken
More information about the thelist
mailing list