Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

editing all columns in a table

Status
Not open for further replies.

leegold

Technical User
Mar 19, 2002
39
US
I have a situation were a table field item has a
situation like: \r\ndata\r\n. So an item's got
line breaks in there with it in the field, and
it's screwing things up for me. How do I do a global
clean-up of this and remove all \r and \n for
all of that column in my table? If it was flat-file
I'd run a Perl regex, but how w/data in MYSQL tables?
What's the strategy?
Thanks for helping with this novice/easy stuff. Lee G.
 
run a regex on the offending column, the mysql manual has quite good info on it.

update mytable set annoying field = REPLACE('\r\n','',annoyingfield);

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
How about:
[tt]
UPDATE tbl SET fld=REPLACE(fld,'\r\n','')[/tt]



-----
ALTER world DROP injustice, ADD peace;
 
Sorry, what , what TonyGroves said is the correct syntax... sorry I'm browsing PHP and mysql forums at the same time and mixing my fuctions.

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top