0

I tried this but it doesn't work. I want to find all the inputs which do not have a valid e-mail with an @ symbol

SELECT * FROM tblEmail
WHERE [email] <> '%@'
xlecoustillier
  • 16,183
  • 14
  • 60
  • 85
Jonathan Lockley
  • 1,320
  • 5
  • 18
  • 28
  • 1
    Dupe http://stackoverflow.com/questions/801166/sql-script-to-find-invalid-email-addresses – Al. May 07 '13 at 12:18
  • possible duplicate of [TSQL Email Validation (without regex)](http://stackoverflow.com/questions/229824/tsql-email-validation-without-regex) – Himanshu May 07 '13 at 12:20

4 Answers4

1

Try this:

SELECT * FROM tblEmail WHERE [email] NOT LIKE '%@%'
Matteo Tassinari
  • 18,121
  • 8
  • 60
  • 81
1

To fully validate an email address using mysql you should do:

SELECT * 
  FROM tblEmail 
 WHERE email NOT REGEXP '^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$';
jtavares
  • 449
  • 2
  • 9
1

maybe using NOT LIKE '%@%'

SELECT * FROM tbl where email NOT LIKE '%@%'
VeNoMiS
  • 330
  • 5
  • 15
1

Your current query is searching for an @ symbol at the end of the text only. If you need to match anywhere within the text (which is the case for emails) I expect you need to use '%@%'.

Hence your full query might look like

SELECT * FROM tblEmail Where [email] NOT LIKE '%@%'
Kami
  • 19,134
  • 4
  • 51
  • 63