I have a problem I have a "text" field with a bunch of "stories" that are pasted from word and such and as such include things like line breaks and tabs. I want to export to CSV maintaining these or be able to get them back.
But I can't figure out how to escape them so it works? When I export CSV I get a CSV with a bunch of single sentences on multiple rows/columns.
I tried replacing the news lines with other stuff but I kept messing up. Is there an easy way to do this without destroying data?
CSV is not a good format for arbitrary text, but you can TRY
SELECT ... INTO OUTFILE '/tmp/text.csv' FIELDS ESCAPED BY '""' TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM yourtable