Skip to content

Instantly share code, notes, and snippets.

@vkbandi
Created September 16, 2015 19:46
Show Gist options
  • Save vkbandi/0057b35d75609cd68abe to your computer and use it in GitHub Desktop.
Save vkbandi/0057b35d75609cd68abe to your computer and use it in GitHub Desktop.
T-SQL Query will retrieve anything that is after the @ symbol, the query can be very useful for retrieving the domain of an email address
SELECT SUBSTRING(T.Email,(CHARINDEX('@',T.Email)+1),LEN(T.Email) - (CHARINDEX('@',T.Email))) as DomainName FROM EmailTable T
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment