>I have a table with a field called email. >I would like to make sure that all email are valid. >How can I build a select statement that will return all the records that do not have a .com or .net in the email field. > >Select * from emails WHERE ".com" OR ".net" is not in the email field > >Any help is appreciated. > >Thanks
Sergio, Validating such data are better done with regular expressions. T-SQL doesn't directly support regular expression search but you can create a .net udf in SQL 2005 and later that does it for you. Or even you can create an xp in older versions. Or you can use regular expression search client side.
(In the first link interestingly enough email is used to test the function:)