Replacing part of a substring with the substring

  • I'm attempting to use the following query to update the substring %/themes/old/%

    with '%/themes/new/%'

    update bodyTextTable

    set bodyText = replace (bodyText, '%/themes/old/%', '%/themes/new%')

    But I am returned the following error -

    Msg 8116, Level 16, State 1, Line 15

    Argument data type ntext is invalid for argument 1 of replace function.

    So to get round the ntext issue, I have used executed the following...

    update bodyTextTable

    set bodyText = replace (bodyText, '%/themes/old/%', '%/themes/new%')

    But the expected changes are not reflected in the table.

  • duplicate post.

    Do not post replies to this thread.

    Use this thread to post all replies.

    Wayne
    Microsoft Certified Master: SQL Server 2008
    Author - SQL Server T-SQL Recipes


    If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
    Links:
    For better assistance in answering your questions
    Performance Problems
    Common date/time routines
    Understanding and Using APPLY Part 1 & Part 2

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

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