PHP forums, MySQL forums, Web Development resources

Home PageHome    PHP ResourcesTopic List    FAQFAQ    SearchSearch    MemberlistMemberlist    UsergroupsUsergroups 
 RegisterRegister
    ProfileProfile    Log in to check your private messagesLog in to check your private messages    Download the RSS Reader RSS Feed Download the RSS Reader RSS for this forum Log inLog in 

PHP Forum :: MySQL Forum :: Java Script Forum



Parsing out special characters in outfile

 
Post new topic   Reply to topic    WeberForums.com Forum Index -> MySQL General
View previous topic :: View next topic  
Author Message
clem_c_rock



Joined: 18 Aug 2004
Posts: 19

PostPosted: Thu Feb 28, 2008 5:30 am    Post subject: Parsing out special characters in outfile Reply with quote

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
Back to top
View user's profile Send private message
clem_c_rock



Joined: 18 Aug 2004
Posts: 19

PostPosted: Thu Feb 28, 2008 8:32 pm    Post subject: Reply with quote

Found the solution I was looking for (nested REPLACE statements):


insert into artists(name) values(REPLACE(REPLACE(REPLACE(name,'!', ''),'"', ''),'\302\256', '') );
Back to top
View user's profile Send private message
Display posts from previous:   
WeberTrivia Questions WeberTrivia Questions
 Think you are smart? Prove it!. Try your skills with these questions :
 WeberTrivia QuestionsRecursive arrays and multi-dimensional arrays are one and the same. (PHP and MySQL)
 WeberTrivia QuestionsThe \"cache_dir\" tag of the squid configuration has a default of /var/spool/squid. (Linux)

WeberTrivia Questions



Post new topic   Reply to topic    WeberForums.com Forum Index -> MySQL General All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
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
You cannot vote in polls in this forum






Powered by phpBB © 2001, 2005 phpBB Group
PHP Forum :: MySQL Forum :: Java Script Forum