views:

47

answers:

2

I need to write a SQL function that will allow me to strip an email address to the bare domain name. EX: I would make [email protected] read as [email protected]. This is most likely very simple but, I cannot seem to find any information on it.

A: 

If you are using Oracle:

select substr('[email protected]',instr('[email protected]','@')+1,length('[email protected]')) as domain from dual;
Sammy Boy
A: 

You might want to try creating a CLR SQL function and use regex from your .net library to parse the string. From the looks of it you may have to parse the ccTLD if it exists and then parse the generic TLD/domain name.