February 3, 2012 at 12:58 pm
Hi All,
i have table name called messages
below is structure of the table
contentID int
Contentmessage varchar not null
and it has below data values
ContenID ContentMessages
1 We have not received a payment for your loan account. this is debt collecor.
2 We have received a payment for your loan account.this is debt collecor.
i have to remove the 'this is debt collecor' from the text.i have total more then 1000 row to remove it which contain 'this is debt Collector.
can please help me how i can remove 'this is debt collector' from the all rows?
Any Help would be appreciated
Thank you.
Unnati
February 3, 2012 at 1:12 pm
How about this?
DECLARE @Message Table ( ContenID INT , ContentMessages VARCHAR(2000))
INSERT INTO @Message (ContenID, ContentMessages)
SELECT 1, 'We have not received a payment for your loan account. this is debt collecor.'
INSERT INTO @Message (ContenID, ContentMessages)
SELECT 2, 'We have received a payment for your loan account.this is debt collecor.'
-- Code
SELECT REPLACE(ContentMessages,'this is debt collecor','') ContentMessages
FROM @Message
February 3, 2012 at 1:16 pm
Hi Unnati,
If I'm reading that right you want
We have not received a payment for your loan account. this is debt collecor.
We have received a payment for your loan account.this is debt collecor.
to become
We have not received a payment for your loan account.
We have received a payment for your loan account.
Correct?
If so, an UPDATE statement using REPLACE on the ContentMessage field should do the trick.
(Use a blank string as the third expression in the REPLACE clause)
Regards
Gaz
February 3, 2012 at 10:46 pm
February 9, 2012 at 10:33 am
Thank you very much Thats perfact.
i appreciated!!
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply