This was one of the quick task that I was required to work where i need to get the domain name from the email address.
How to extract domain name from email address in SQL Server ?
Assuming the table name is CustomerEmailAddress and we have a column called emailAdress.
Here’s a simple query demonstrating how to do this.
Select emailAdress, right(emailAddress, charindex('@', reverse(emailAddress))-1) FROM CustomerEmailAddress