I have to extract just domain name in email without domain extension. Example I have email address katad@hotmail.com
and I need just hotmail
as output so I can compare with known and accepted domain list.
I tried to use this but it's not output I was hoping for:
SUBSTRING(subscribers_email,(CHARINDEX('@',subscribers_email)+1),(CHARINDEX('.',subscribers_email)))
2nd example: I have email as
d.katana@us.army.mil
, I will need
us
as domain and when comparing to domain list will result as valid. 3rd example: I have email as Dra.Katana@us.army.mil, I will need
us and when compared it should be valid, currently it would be null as domain for some reason.