开发者

Mysql query deleimiter in a file

开发者 https://www.devze.com 2023-04-04 11:48 出处:网络
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..

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

精彩评论

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

关注公众号