Replace query needed

Posted on 2007-07-25
Last Modified: 2012-05-05
MSSQL Server 2000

I have a field where the content could be something like:

mannn ackenn irnrr

This is what I need to do.  I need to find, for instance, all instances of "ackenn" and change it to "acken"
I don't need to set the entire value of the field to "acken". I just need to replace all instances of "ackenn" with "acken"

Question by:isaacr25
    LVL 92

    Accepted Solution

    UPDATE YourTable
    SET YourColumn = REPLACE(YourColumn, 'ackenn', 'acken')
    LVL 18

    Expert Comment

    by:Sham Haque
    SELECT REPLACE (yourField,'ackenn','acken')

    this will affect only the part you are replacing...

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
    JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
    Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
    Via a live example, show how to shrink a transaction log file down to a reasonable size.

    745 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

    15 Experts available now in Live!

    Get 1:1 Help Now