Replace characters in field as a part of a SQL select

Posted on 2011-10-24
Last Modified: 2012-05-12
I have a table with partnumbers and their descriptions that I need to load into another application.

The problem is that there are some characters in the source description that are invalid in the target application.

What I'd like to do is generate a select statement that creates an output where the description no longer contains the invalid character, however each invalid character has a corresponding valid character.

For example if I have a partnumber description RIB+238^RTD I need to generate an output description in the select which replaces the + with / and the ^ with %.

Question by:jdr0606
    LVL 2

    Accepted Solution

    have you tried a nested replace? SELECT REPLACE(REPLACE(partdesc,'+','/'),'^','%')

    Author Closing Comment

    That worked perfectly!

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    Suggested Solutions

    If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
    Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
    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…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    732 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

    17 Experts available now in Live!

    Get 1:1 Help Now