Replace function

  • Hi,

    Which is the best\elegant way to update a string in nvarchar(MAX) column?

    The record contains a string similar to this:

    'The dog cat sat on the mat'

    I just want to replace the above to this:

    'The cat sat on the mat'

     

    Is this is the best way:

     


    UPDATE myTable SET
    ColumnB=REPLACE(ColumnB,'dog cat','cat' )
    WHERE ColumnC='SentenceOne'

    Thank you

  • That works.

    Michael L John
    If you assassinate a DBA, would you pull a trigger?
    To properly post on a forum:
    http://www.sqlservercentral.com/articles/61537/

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply