exporting a table in MySQL with columns that have newline characters

后端 未结 2 1978
礼貌的吻别
礼貌的吻别 2021-01-04 20:31

I am pretty inexperienced in SQL, so there should be a simple solution to my problem: I am selecting a table into a comma-separated file, and the column of type TEXT has new

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-04 21:05

    Just enclose everything in double quotes perhaps.

    SELECT * FROM db.table INTO OUTFILE 'c:/result.txt'  FIELDS TERMINATED BY ',' ESCAPED BY '\\' ENCLOSED BY '"' LINES TERMINATED BY '\r\n';
    

提交回复
热议问题