iIS NOT NULL...

Got a problem with IS NOT NULL in PHPadmin within Cpanel.  I have some address fields that are NULL.  I don't want these in my list, so I'm asking for the ADDRESS field without data to not be output.  That is, WHERE ADDRESS IS NOT NULL.

This does not work in PHPadmin in Cpanel.  There is an anomaly.

How can I fix this?
Curt GustafssonAsked:
Who is Participating?
 
Pawan KumarDatabase ExpertCommented:
welcome. Glad to help as always. :)

Cheers !!
0
 
Dave BaldwinFixer of ProblemsCommented:
It works perfectly here on 3 different servers and 4 different databases.  When you browse that table, does it actually say NULL in those fields?  Blank is not the same as NULL.
0
 
Curt GustafssonAuthor Commented:
OK, good point.  The field does not display NULL when empty.  

However, when searching for  possible variants such as IS NOT EMPTY, or IS NOT BLANK, it seems the response always defaults to IS NOT NULL, or IS NULL.

Seems we need to take this a bit further.
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
Dave BaldwinFixer of ProblemsCommented:
If it doesn't say NULL, I would use...
WHERE ADDRESS <> ''

Open in new window

It's possible that there are spaces in the field which would still cause it to show up because it is not empty or blank.  Just useless.
0
 
Pawan KumarDatabase ExpertCommented:
You can use like this....

WHERE yourcolumn <> '' AND yourcolumn  IS NOT NULL

OR

WHERE LEN(yourcolumn) > 0 /* You need to use the length function. Its performance will be slow from the first one*/
0
 
Curt GustafssonAuthor Commented:
Have never smoked, and never will.  But if I were cigar user, I'd pass some out to both Dave and Pawan for WHERE ADDRESS <> '' .

Works like a charm!

Thanks.  You made my day!

Curt
1
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.