开发者

Mysql query deleimiter in a file

In the following query if desc has "\" in it and this file when opened by openoffice the \ and appears in a different coulmn.This also happens with city column,How to recitfy this..

select first_name, last_name, emp_id,desc,city from emp_table where event_id = 4 order by 开发者_C百科city asc   into OUTFILE "/tmp/Sep10-1.csv"   FIELDS TERMINATED BY ",";


Add ESCAPED BY clause to escape special characters in dump.

select 
  first_name, last_name, emp_id,desc,city 
from 
  emp_table 
where 
  event_id = 4 
order by 
  city asc   
into OUTFILE 
  "/tmp/Sep10-1.csv"   
FIELDS 
  TERMINATED BY "," 
  ESCAPED BY "\";
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜