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 2000 Forums
 Transact-SQL (2000)
 Help

Author  Topic 

lemondash
Posting Yak Master

159 Posts

Posted - 2004-12-08 : 06:27:45
Hey guys it seems like a really easy one and it may well be for you lot. But i have a table and within that table is a email colounm. Now the problem is inside the email field a good few of the emaill address have change but not their names but domain name. So it used to be fred.powers@pops.com but now it is fred.powers@popsuk.com so i want to just change the domian part of the email address. hope you can help.

Regards Lee

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-12-08 : 06:37:01
declare @email varchar(50)
set @email = 'fred.powers@pops.com'

select @email, replace(@email, substring(@email, charindex('@', @email)+1, len(@email) - (len(@email) - charindex('.', reverse(@email))+1)), 'popsuk')



Go with the flow & have fun! Else fight the flow
Go to Top of Page

lemondash
Posting Yak Master

159 Posts

Posted - 2004-12-08 : 06:52:03
Should have mention, that there was more then one email address, different name but the domian is the same.
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-12-08 : 07:00:44
doesn't matter. put the column name instead of @email

Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -