Len vs Is Not Null

  • Thread starter Thread starter Lars Pedersen
  • Start date Start date
L

Lars Pedersen

It seems like that :
where len(tbl.Skip.Name)
gives the same answer as:
where tbl.Skip.Name Is Not Null

Which one is best then?

/Lars
 
In terms of speed, I don't know, you could test it with a dummy table
with random data, say 1 million or so records.

In terms of making sense, I'd use "where tbl.Skip.Name Is Not Null".

The "where len(tbl.Skip.Name)" coerces a "logical" result with a length
of zero equalling "False" and a length of anything else equalling "True"
- at least as far as my understanding goes. Yuk.

Regards,
Andreas
 
Thanks, I am using Is Not Null now, but I was copying an old procedure where
I had Len(tblSkip.Name) >0, then I saw that Len(tblSkip.Name) returned the
same records, but I also saw that Is Not Null made more sense.

/Lars
 
You are welcome.

Regards,
Andreas


Lars said:
Thanks, I am using Is Not Null now, but I was copying an old procedure where
I had Len(tblSkip.Name) >0, then I saw that Len(tblSkip.Name) returned the
same records, but I also saw that Is Not Null made more sense.

/Lars
 
Using Len in place of IsNull also captures empty strings (""), which,
depending upon the table's design, may be present in a field if a person
entered something and then deleted it or replaced it with an empty string.
 
Yes, just why did Microsoft change the default settings for Text fields
in XP+? For use with FrontPage? Causes all sorts of problems for the
unaware!

Andreas
 
Back
Top