将SQL结果导出为CSV,但在字段中保留换行值

时间:2017-09-28 02:59:23

标签: mysql csv export-to-csv sequelpro

我正在尝试通过Sequel Pro将查询结果导出为CSV,我想保留其换行值。

我尝试使用REPLACE()转义,我也尝试使用其他终结符,例如;

我的内容看起来像这样

The word "adore" means to love something deeply. Other words that mean the same as adore are 
"cherish, treasure, love dearly" 

如何将此数据导出为CSV以保留换行符?

请注意,后面有<{1>}字符后跟换行符。

1 个答案:

答案 0 :(得分:1)

如果我没记错的话,您可以选择使用逗号作为分隔符,用&#34;将整个字符串内容括起来。在字符串的前端和末端,逃避&#34;用&#34;&#34;在你的字符串中,这样你就可以保留新的内容。

例如,而不是:

The word "adore" means to love something deeply. Other words that mean the same as adore are 
"cherish, treasure, love dearly" 

尝试将上述内容更改为:

other_content_in_csv,"The word ""adore"" means to love something deeply. Other words that mean the same as adore are 
""cherish, treasure, love dearly"" ",other_content_in_csv