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
 General SQL Server Forums
 New to SQL Server Programming
 using replace

Author  Topic 

lemondash
Posting Yak Master

159 Posts

Posted - 2007-11-29 : 05:24:09
I have a colunm in a table that has a list of email address.
I want to remove a certain email address from that colunm, but it is in 54 different rows. What is the best way to do this ?

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-11-29 : 05:35:56
Use combination of UPDATE with REPLACE().

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2007-11-29 : 05:36:15
[code]
declare @test table(test varchar(50))
insert into @test
select 'anemail@blahblah.com; email@test.com' union all
select 'anotheremail@blahblah.com; email@test.com'

update @test
set test = replace(test,'email@test.com','')
from @test

select * from @test
[/code]

Em
Go to Top of Page
   

- Advertisement -