Query Database For Table - Email that has a blank, missing, or no data

I have a membership database.  One of the fields is "Email".  That field CAN be blank.  I'd like to query the database and find all member records with no data in the Email field.  That we can reach out to those members and ask them to update their e-mail address.

SQL database.  Thank you.
derrickisonlineAsked:
Who is Participating?
 
zephyr_hex (Megan)Connect With a Mentor DeveloperCommented:
It's not entirely clear what you're looking for... but to find blank or NULL Email records, you would do:

SELECT * from MyTable WHERE Email IS NULL OR Email = ''

Open in new window

0
 
derrickisonlineAuthor Commented:
You stated you didn't know what I was looking for, but that was exactly it.  I just needed to know which records had a missing email address field.  That way we can reach out and have members update their email addresses.  

Thank you!
0
 
awking00Commented:
Slight variation -
SELECT * from MyTable WHERE ISNULL(Email,'') = ''
0
Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

 
Russ SuterCommented:
I might slightly enhance what is above to perform at least a rudimentary search for a valid email address.
SELECT * FROM myTable WHERE Email IS NULL OR Email NOT LIKE '%_@__%.__%'

Open in new window

This at least guarantees that the email address will have a minimum of a single "@" and a single "."
This query would return empty, blank, and invalid email addresses.
0
 
derrickisonlineAuthor Commented:
One more thing, can you tell me how to use the query you provided but drilling down again buy saying Membership Status = Active?
0
 
zephyr_hex (Megan)DeveloperCommented:
SELECT * from MyTable WHERE (Email IS NULL OR Email = '') AND [Membership Status] = 'Active'

Open in new window

1
 
derrickisonlineAuthor Commented:
Thanks again!
0
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.