Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple way of Exporting and Importing a Table

Status
Not open for further replies.

dbuxton101

IS-IT--Management
Nov 13, 2013
133
0
0
AU
Hey I am looking to find a way to export data from a database and import to the same structured database but on a different server.

I have managed to export the data by going
psql -U Administrator -d cc -c "COPY cntcfg TO 'C:\cntcfg.txt' DELIMITER ',' CSV;"

but when I try the import
psql -U Administrator -d cc -c "COPY cntcfg FROM 'C:\cntcfg.txt' DELIMITER ',' CSV;"

I receive an error
ERROR: duplicate key value violates unique constraint "cntcfg_stattype_cntid_tasktype_idx"
DETAIL: Key (stattype, cntid, tasktype)=(7, 8000, 1) already exists.
CONTEXT: COPY cntcfg, line 1

Please help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top