Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sql script to find invalid email addresses

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).

like image 788
campo Avatar asked Apr 29 '09 06:04

campo


1 Answers

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

  • I've answered a similar question some time ago: TSQL Email Validation (without regex)
  • T-SQL: checking for email format
  • Regexp recognition of email address hard?
  • many other Stack Overflow questions
like image 92
Tomalak Avatar answered Sep 23 '22 01:09

Tomalak