Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 email address

Author  Topic 

sbalk
Starting Member

2 Posts

Posted - 2010-02-10 : 22:09:52
I would like to remove the domane from a email address.
ABCD@1234.com what I need is ABCD

Thanks.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-02-10 : 22:16:26
[code]
select left(email_addr, charindex('@', email_addr + '@') - 1)
from yourtable
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-11 : 00:14:19
[code]select stuff(email_addr,CHARINDEX('@',email_addr),LEN(email_addr),'') FROM Table[/code]

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2010-02-11 : 00:27:17
select SUBSTRING('ABCD@1234.com',0,charindex('@','ABCD@1234.com',0))

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page

sbalk
Starting Member

2 Posts

Posted - 2010-02-12 : 08:39:46
Thanks all with your help I was able to make it work.

have a great day.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-12 : 08:41:11
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -