Results 1 to 10 of 10
  1. #1
    Join Date
    Apr 2008
    Posts
    36

    Question Unanswered: How to remove slashes from a table using a query?

    I've tried using
    Code:
    UPDATE `table_name` SET `table_column` = '' WHERE `table_column` = '\'
    but I get a syntax error message.
    TIA!
    Leafgreen
    Last edited by Leafgreen; 12-22-10 at 20:10.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    try
    Code:
    ... = '\\'
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Apr 2008
    Posts
    36
    Hi again Rudy! Long time

    Actually I tried that before. It ran without errors but didn't remove the \ character.

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by Leafgreen View Post
    It ran without errors but didn't remove the \ character.
    let's clarify

    according to your posted attempt, you have some column values consisting of only the backslash, and you want to set those value to nothing?

    or, as i suspect, what you want instead is to remove the backslashes but leave whatever else is there?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    Apr 2008
    Posts
    36
    Yes, the latter. Or, replace \' with '

  6. #6
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Code:
    UPDATE table_name 
       SET table_column = REPLACE(table_column,'\\','')
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  7. #7
    Join Date
    Apr 2008
    Posts
    36
    Yes, this worked! But it worked in PHPMyAdmin and did not work in MySQL-Front, which is the interface I normally love for direct db access. What's your favority MySQL interface on Windows?

  8. #8
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by Leafgreen View Post
    What's your favority MySQL interface on Windows?
    heidisql
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  9. #9
    Join Date
    Apr 2008
    Posts
    36
    Just checked it out. Looks incredible! And free no less. Thank you.

  10. #10
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    ...other MySQL interfaces are available, such as MYSQL Query browser available from the MySQL site
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •