November 11, 2009 at 11:13 pm
Dear All,
I have a table called EMailNotify.
To_Address is a column which contains email address.
The record should be present the column like
a.b.ssl@test.com, ss.t@test.com,s.m@test.com, ma.ram @test.com,mk.p@test.com
Let us say when I select the table
Select * from EMailNotify
Id To_Address
1a.b.ssl@test.com, ss.t@test.com,s.m@test.com, ma.ram @test.com,mk.p@test.com
2a1.b.ssl@test.com, ss.t@test.com,s.m@test.com, ma.ram @test.com,mk.p@test.com
3a2.b.ssl@test.com, ss.t@test.com,s.m@test.com, ma.ram @test.com,mk.p@test.com
I want how to write a query which will remove all the ss.t@test.com mail id from the column “To_Address”
After changing the query it should print like
Select * from EMailNotify
Id To_Address
1a.b.ssl@test.com,s.m@test.com, ma.ram @test.com,mk.p@test.com
2a1.b.ssl@test.com,s.m@test.com, ma.ram @test.com,mk.p@test.com
3a2.b.ssl@test.com,s.m@test.com, ma.ram @test.com,mk.p@test.com
Please help for the needful.
Thanks a lot in advance.
Regards,
Sumanta Panda
November 11, 2009 at 11:29 pm
Try this one!
DECLARE @WORD VARCHAR(500)
SET @WORD = 'ss.t@test.com, a.b.ssl@test.com,ss.t@test.com, s.m@test.com, ma.ram @test.com,mk.p@test.com,ss.t@test.com'
SELECT REPLACE(REPLACE(@word,'ss.t@test.com,',''),',ss.t@test.com','')
Inform us if it works!
Cheers!
[Edited to remove the white spaces in the REPLACE]
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply