I am not a developer or especially knowledgeable in MS SQL, but I am the person responsible for creating special queries for my companies SQL Database. I have a query that is selecting customer names, addresses, product ordered and e-mail addresses. I am want to select only those customers with an e-mail addresses (i.e. JohnSmith@AnyTown.Com). My problem is that the people entering the data aren't consistent in how they record a refusal to give an e-mail address(i.e. "Nope", "N/A", "No", etc.). I know that ALL e-mail addresses have the format USER_NAME@DOMAIN_NAME. I would like the selection criteria to be something like: select when EmailAddress is like "*@*".

Thank you in advance

10 Years
Discussion Span
Last Post by Jx_Man

SELECT * FROM Customers where EmailAddress like '%" @ "%'"

Why do we need double quotes around @ ? ("@")
PS. I tried it and it gave me an error.
We can use SELECT * FROM customers where emailaddresses like '%@%';

Votes + Comments

yeah, you're welcome and thx to nav33n to nice recovery. :)
don't forget to mark this solved.
All for the best.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.