nisupport
asked on
Replace line breaks with a space with using Select.. Into Outfile
I am running a query to download a csv. Some of the fields might contain line breaks, which makes the program reading the file think that the record has ended, messing up the column count. Can I replace the breaks with a space or make it ignore the breaks?
SELECT
p.prodid,
r.id,
r.rganum,
p.partnum,
p.description,
p.mfgmonth,
p.mfgyear,
p.produse,
p.lot,
p.amount,
p.unitMeasure
INTO OUTFILE '$file2'
FIELDS TERMINATED BY ';'
LINES TERMINATED BY '\n'
FROM
ns_rgaproduct p,
ns_rga r
WHERE
r.status = 'approved'
and r.decdate >= '$exportdate'
and r.id = p.rgaid
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Other than '\n', you can try:
'\r\n'
NOTE:You need to use the replace on every field that may potentially have the newline.
'\r\n'
NOTE:You need to use the replace on every field that may potentially have the newline.
ASKER
Figured it out needed to put '\r\n' for the line break.
glad to help
ASKER