It is currently Sat Feb 04, 2012 3:45 pm

All times are UTC + 2 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Parsing out special characters in outfile
PostPosted: Thu Feb 28, 2008 6:30 am 
Offline

Joined: Wed Aug 18, 2004 5:06 pm
Posts: 21
Hello,
I am looking for a way to parse out certain characters when I write a select statement to an outfile.

I know how to escape the characters w/ the escaped by clause, but I need to parse off some double quotes and some backslashes.

I'm currently trying this:

Code:
select id, name  from artists where id in(14346, 25919, 76150) INTO OUTFILE '/tmp/test_5.csv' FIELDS TERMINATED BY ','  ESCAPED BY '\\'  LINES TERMINATED BY '\n'


Is there anyway to do this w/ native mysql functions?

Thanks,
Clem


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 28, 2008 9:32 pm 
Offline

Joined: Wed Aug 18, 2004 5:06 pm
Posts: 21
Found the solution I was looking for (nested REPLACE statements):


insert into artists(name) values(REPLACE(REPLACE(REPLACE(name,'!', ''),'"', ''),'\302\256', '') );


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 2 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron