SQL statement to find and replace character in field...

Posted on 2009-12-20
Last Modified: 2012-05-08
Can someone tell me the correct statement to use in order to find and replace specific characters in a field....for example

Find all the "/" in all records of the telephone number field
and replace it with "-"

I am sure this is very straight forward, but I am a dummy with SQL.
Question by:IO_Dork
    LVL 14

    Accepted Solution

    update YourTable set YourField with CHRTRAN(YourField,'/','-')

    Author Closing Comment

    Fantastic!  Direct and to the point!
    LVL 41

    Expert Comment

    This command will raise syntax error

    You have two options:
    update YourTable set YourField = CHRTRAN(YourField,'/','-')

    SELECT YourTable
    REPLACE ALL YourField with CHRTRAN(YourField,'/','-')
    LVL 14

    Expert Comment



    Author Comment

    Thanks pcelba!!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: (http://msd…
    Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    737 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

    19 Experts available now in Live!

    Get 1:1 Help Now