mysql& INTO OUTFILE - 转义或替换数据中的新行
我有以下 sql 语句将 sql 表输出到 csv 文件。
在“内容”列中找到的一些数据包含导致问题的换行符,有没有办法将所有 \n 替换为 's?
SELECT id, title, content
INTO OUTFILE '/content.csv'
FIELDS TERMINATED BY ',' ESCAPED BY '\\' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM content
I have the following sql statement to out put a sql table to a csv file.
Some data found in the column 'content' includes new line charactors which is causing issues, is there a way to replace all \n with 's?
SELECT id, title, content
INTO OUTFILE '/content.csv'
FIELDS TERMINATED BY ',' ESCAPED BY '\\' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM content
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试:
其中
CHR(13)
代表新行。Try:
where
CHR(13)
represents new line.