0

我有两台 Windows 机器;每台机器都有一个 .NET C# 应用程序,用于将数据插入 PostgreSQL 数据库表。两台机器都有完全相同的 4 个表,它们是:Binfiles、gendata、leave 和 training。

但是每台机器都有不同的插入记录。我想将插入的数据合并到一台机器上。最好的做法和最简单的方法是什么?

4

1 回答 1

1

From one of your machines tables

 COPY binfiles TO '/tmp/binfiles.csv' DELIMITER ',' CSV HEADER;
 COPY gendata TO '/tmp/gendata.csv' DELIMITER ',' CSV HEADER;
 COPY leave TO '/tmp/leave.csv' DELIMITER ',' CSV HEADER;
 COPY training TO '/tmp/gendata.csv' DELIMITER ',' CSV HEADER;

then on your other machine you copy from

 COPY binfiles FROM '/tmp/binfiles.csv' DELIMITERS ',' CSV;

and so forth. or you could do it in SQL, but you would first need to have both sets of tables insert into newBin select * from oldbin

于 2013-02-28T04:41:37.293 回答