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
StageMgrRob

Recommended Answers

All 5 Replies

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

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 '%@%';

commented: :P +1

ah, i'm sorry for this failure. thx for the recovery.:)

Thank you all. That is what I was looking for. :icon_cheesygrin:

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.