format fields

Posted on 2007-10-10
Last Modified: 2013-12-13
I have some fields in the database, where the information is already entered in an invalid way
suchas with spaces and or hyphens, I would like to remove them and put the whole variable in uppercase
Question by:bdipasquale
    LVL 50

    Accepted Solution

    Use an UPDATE statement to change the data.  Make sure you take a backup of the existing data before starting your work.

    UPDATE MyTable SET MyField=UPPER(MyField);
    UPDATE MyTable SET MyField=REPLACE(MyField,'-','');

    Author Comment

    I dont want to do this because, the way it is in the database, is the way I want it, but Im sending the info to someone via xml, they require a phone number is sent to them like 5145551212, in our database its stored as 514-555-1212, so the formating needs to be done in php code, after taking the info from datbase so the info in db is not affected
    LVL 50

    Expert Comment

    by:Steve Bink
    Or could create a copy of the table, change the data, then send the copy to your someone.  Delete the copy when you're done.

    If you still want to do it in PHP, see these links:

    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

    Join & Write a Comment

    What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
    Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
    Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
    The viewer will learn how to count occurrences of each item in an array.

    755 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

    21 Experts available now in Live!

    Get 1:1 Help Now