derrickisonline
asked on
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.
SQL database. Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Slight variation -
SELECT * from MyTable WHERE ISNULL(Email,'') = ''
SELECT * from MyTable WHERE ISNULL(Email,'') = ''
I might slightly enhance what is above to perform at least a rudimentary search for a valid email address.
This query would return empty, blank, and invalid email addresses.
SELECT * FROM myTable WHERE Email IS NULL OR Email NOT LIKE '%_@__%.__%'
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.
ASKER
One more thing, can you tell me how to use the query you provided but drilling down again buy saying Membership Status = Active?
SELECT * from MyTable WHERE (Email IS NULL OR Email = '') AND [Membership Status] = 'Active'
ASKER
Thanks again!
ASKER
Thank you!