March 20, 2014 at 12:36 pm
Hi,
I am using the below function to validate the email address
ALTER FUNCTION [dbo].[udf_ValidateEmail] (@email varChar(255))
RETURNS bit
AS
begin
return
(
select
Case
When @Email is null then 0 --NULL Email is invalid
Whencharindex(' ', @email) <> 0 or--Check for invalid character
charindex('/', @email) <> 0 or --Check for invalid character
charindex(':', @email) <> 0 or --Check for invalid character
charindex(';', @email) <> 0 then 0 --Check for invalid character
When len(@Email)-1 <= charindex('.', @Email) then 0--check for '%._' at end of string
When @Email like '%@%@%'or
@Email Not Like '%@%.%' then 0--Check for duplicate @ or invalid format
Else 1
END
)
end
but it is not validating whether i have .com/.org/.net/.co.uk/.co.in/.in
which means it should have to check i must have domain name after dot(.)
please help me on validating the email address
March 21, 2014 at 5:31 am
wondering no reply for this. Anyhow Finally i ended up with writing CLR function to achieve this.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply