Need a Help

  • 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

  • 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

  • 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

  • update dbo.messages

    set ContentMessage = replace(ContentMessage, 'this is debt collecor.', '');

    go

    └> bt



    Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • 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