0

我正在尝试从中导出数据PostgreSQL并将其导入SAP Hana. 即'\n'换行符会自动从 TEXT 数据中删除。

例子:

A 1,750 word essay is 11 to 12 paragraphs.
A 2,000 word essay is 13 to 14 paragraphs.
A 2,500 word essay is 16 to 17 paragraphs.
A 3,000 word essay is 20 paragraphs.

正变成

A 1,750 word essay is 11 to 12 paragraphs.A 2,000 word essay is 13 to 14 paragraphs.A 2,500 word essay is 16 to 17 paragraphs.A 3,000 word essay is 20 paragraphs.

我正在使用以下命令:

PostgreSQL

\COPY table_name TO 'path\data.csv' WITH CSV DELIMITER ',';

IMPORT FROM CSV FILE path
INTO table_name
WITH RECORD DELIMITED BY '\n'
FIELD DELIMITED BY '\t'
OPTIONALLY ENCLOSED BY '"';
4

2 回答 2

0

您可以使用DBeaver代替导出和导入 CSV 文件,它同时支持 SAP HANA 和 PostgreSQL。

可以在此处找到在 dbms 之间移动数据的说明: https ://dbeaver.com/docs/wiki/Data-migration

于 2022-01-21T13:24:54.393 回答
0

\使其被识别为 a escape character,必须使用文本格式。

COPY table_name  from 'path\data.csv' delimiter ',' TEXT

来源: 带有文字分隔符的 Postgres COPY 命令

于 2019-12-02T10:34:25.860 回答