[Webinar] Learn how to a build a cloud-first strategyRegister Now


Replace characters in field as a part of a SQL select

Posted on 2011-10-24
Medium Priority
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

Accepted Solution

ahensch earned 2000 total points
ID: 37021470
have you tried a nested replace? SELECT REPLACE(REPLACE(partdesc,'+','/'),'^','%')

Author Closing Comment

ID: 37122932
That worked perfectly!

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article will provide a solution for an error that might occur installing a new SQL 2005 64-bit cluster. This article will assume that you are fully prepared to complete the installation and describes the error as it occurred durin…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

867 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