Replace part of ntext field SQL

Posted on 2009-12-23
Last Modified: 2012-06-27
I used that code:

UPDATE CMRC_Products set Desc = replace(Cast(LongDesc AS NVARCHAR(Max)), '+ System.Configuration.ConfigurationManager.AppSettings["Domain"]+', '')

Its says row affected, but its not true... noting was changed!

So I want to change the part of the email address ( in the file to + System.Configuration.ConfigurationManager.AppSettings["Domain"]+'

Any help?
Question by:JustAskMe
    LVL 75

    Accepted Solution

    your replace structure in in the reverse order

    UPDATE CMRC_Products set Desc = replace(Cast(LongDesc AS NVARCHAR(Max)), '','+ System.Configuration.ConfigurationManager.AppSettings["Domain"]+')
    LVL 10

    Assisted Solution


    that's what you are trying to do.
    select REPLACE('', '', '')

    basically you look for yourdomain in the string and try to replace it with ''

    and that's what you want to do:
    select REPLACE('', '', '')


    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
    Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now