An alternative example is an article on a website that is created in a series of steps.

First you add the title, author and publication dates.
At some later stage you add the summary and body.
At a later stage you upload any image you want to display with the article.

When deciding if an article is ok to publish you want to know if all 3 steps have been completed.

If the title is non-blank you know step 1 has been completed.
If the body is non-blank you know step 2 has been completed.
If the image is non-blank you know step 3 has been completed.

If the image is blank, but not null you know the article has no image. If it is null you know the step hasn't been completed.

Obviously you can add an extra flag to the database to indicate that the article has no image, but checking for null is a valid way to do it too.

Spike

Barney Boisvert wrote:
SELECT user.firstname AS parent, child.firstname AS child
FROM user
  LEFT OUTER JOIN user child ON user.userID = child.parentID

If 'child' is the empty string, does the user not have a child, or is
the child's record incomplete, perhaps because it wasn't given a name
yet (as is not uncommon for the first day after birth).  Hard to tell
if you don't get back a null.

Yes, it's a contrived example, but it illustrates the point.

cheers,
barneyb

On 5/13/05, Ben Rogers <[EMAIL PROTECTED]> wrote:

Actually, I was looking for an example of when you need to know the
difference between a null value and a zero length string in a record set.

Ben Rogers
http://www.c4.net
v.508.240.0051
f.508.240.0057



--

--------------------------------------------
Stephen Milligan
Code poet for hire
http://www.spike.org.uk

Do you cfeclipse? http://cfeclipse.tigris.org


---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]




Reply via email to