If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > How to remove slashes from a table using a query?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-22-10, 19:02
Leafgreen Leafgreen is offline
Registered User
 
Join Date: Apr 2008
Posts: 36
Question 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 19:10.
Reply With Quote
  #2 (permalink)  
Old 12-22-10, 19:24
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
try
Code:
... = '\\'
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 12-22-10, 19:26
Leafgreen Leafgreen is offline
Registered User
 
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.
Reply With Quote
  #4 (permalink)  
Old 12-22-10, 22:30
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
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?
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 12-22-10, 23:30
Leafgreen Leafgreen is offline
Registered User
 
Join Date: Apr 2008
Posts: 36
Yes, the latter. Or, replace \' with '
Reply With Quote
  #6 (permalink)  
Old 12-22-10, 23:41
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
Code:
UPDATE table_name 
   SET table_column = REPLACE(table_column,'\\','')
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #7 (permalink)  
Old 12-25-10, 23:38
Leafgreen Leafgreen is offline
Registered User
 
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?
Reply With Quote
  #8 (permalink)  
Old 12-26-10, 02:11
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
Quote:
Originally Posted by Leafgreen View Post
What's your favority MySQL interface on Windows?
heidisql
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #9 (permalink)  
Old 12-26-10, 02:40
Leafgreen Leafgreen is offline
Registered User
 
Join Date: Apr 2008
Posts: 36
Just checked it out. Looks incredible! And free no less. Thank you.
Reply With Quote
  #10 (permalink)  
Old 12-26-10, 02:50
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,262
...other MySQL interfaces are available, such as MYSQL Query browser available from the MySQL site
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On