Sql script to find invalid email addresses

campo picture campo · Apr 29, 2009 · Viewed 181.4k times · Source

A data import was done from an access database and there was no validation on the email address field. Does anyone have an sql script that can return a list of invalid email addresses (missing @, etc).

Answer

Tomalak picture Tomalak · Apr 29, 2009
SELECT * FROM people WHERE email NOT LIKE '%_@__%.__%'

Anything more complex will likely return false negatives and run slower.

Validating e-mail addresses in code is virtually impossible.

EDIT: Related questions