create following function :
create function IsValidEmail
(
@email_address varchar(255)
) returns bit
as begin
declare @ErrMsg varchar(max) = ''
IF CHARINDEX(' ',LTRIM(RTRIM(@email_address))) > 0
set @ErrMsg = @ErrMsg + CHAR(13) + 'No Spaces Allowed'
IF LEFT(LTRIM(@email_address),1) = '@'
set @ErrMsg = @ErrMsg + CHAR(13) + '@ can not be the first character of an email address'
IF LEFT(LTRIM(@email_address),1) = '.'
set @ErrMsg = @ErrMsg + CHAR(13) + '. can not be the first character of an email address'
if RIGHT(RTRIM(@email_address),1) = '.'
set @ErrMsg = @ErrMsg + CHAR(13) + '. can not be the last character of an email address'
if LEN(LTRIM(RTRIM(@email_address ))) - LEN(REPLACE(LTRIM(RTRIM(@email_address)),'@','')) <> 1
set @ErrMsg = @ErrMsg + CHAR(13) + ' Add @'
If( CHARINDEX('.',REVERSE(RTRIM(LTRIM(@email_address)))) > 4 )
set @ErrMsg = @ErrMsg + CHAR(13) + '. Add domain name ex: .com'
if( (CHARINDEX('.@',@email_address ) > 0 OR CHARINDEX('..',@email_address ) > 0
OR CHARINDEX('@@',@email_address ) > 0
OR CHARINDEX('#',@email_address ) > 0
OR CHARINDEX('^',@email_address ) > 0
OR CHARINDEX('&',@email_address ) > 0
OR CHARINDEX('*',@email_address ) > 0
OR CHARINDEX('(',@email_address ) > 0
OR CHARINDEX(')',@email_address ) > 0
OR CHARINDEX('+',@email_address ) > 0
OR CHARINDEX('=',@email_address ) > 0)
)
set @ErrMsg = @ErrMsg + CHAR(13) + 'invalid character'
declare @Result bit
if @ErrMsg = ''
set @Result = 1
else
set @result = 0
return @Result
end
go
If this function returns 1 then Email id is valid otherwise it is invalid.