View Full Version : (ASP & MS SQL 2000) How do I recognize a NULL out of a SELECT statement?
07-22-2002, 06:31 PM
How do I recognize a NULL out of a SELECT statement? I need to determine when a field is null but I cant seem to get it. I tried "if len(field) = 0" and "if field = NULL" but neither would fire.
Thanks in advance,
07-22-2002, 06:37 PM
Is Not Null
07-22-2002, 06:47 PM
I tried that... "if field is null" hits every time (even when not null) I also tried "if field = """ and "if field = false" and they don't hit even when null :(
any other ideas?
07-22-2002, 07:56 PM
as a workaround I sorted the query by the field that I need to find the null and that worked for this situation (because I know how the data is constructed). But that wont work for many other situations.
07-24-2002, 12:32 AM
If IsNull(variable) then ...
I've used this many times so I know it works.
07-24-2002, 12:59 AM
I use the same setup at work, and this almost always works for me:
WHERE fieldname IS NULL
Or, as an alternative (this usually works when the above doesn't):
WHERE fieldname = '' (that's two single quotes!)
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.