about copy

Started by bluexiaoover 26 years ago4 messagesgeneral
Jump to latest
#1bluexiao
bluexiao@yeah.net

Hello:
I want to import some data from access97 to postgres, I have save
the data to .CSV file, but how to import it into postgres's db?
I no there is a command in psql can do it. But I forget.

=-=-=-=-=-=-=-=
Take care
=-=-=-=-=-=-=-=

#2Terence Chan
kin.chan@technologist.com
In reply to: bluexiao (#1)
RE: [GENERAL] about copy

You can export the tables from Access97 through ODBC to postgres directly.

R.

Terence

-----Original Message-----
From: owner-pgsql-general@postgreSQL.org
[mailto:owner-pgsql-general@postgreSQL.org] On Behalf Of bluexiao
Sent: Monday, July 19, 1999 2:01 PM
To: postgreSQL
Subject: [GENERAL] about copy

Hello:
I want to import some data from access97 to postgres, I have save
the data to .CSV file, but how to import it into postgres's db?
I no there is a command in psql can do it. But I forget.

=-=-=-=-=-=-=-=
Take care
=-=-=-=-=-=-=-=

#3Gene Selkov, Jr.
selkovjr@mcs.anl.gov
In reply to: bluexiao (#1)
Re: [GENERAL] about copy

I want to import some data from access97 to postgres, I have save
the data to .CSV file,

CSV is difficult to parse and I am not sure postgres can hadle it.
Use delimited formats, best of all tab-delimited -- your access97
does that, too.

but how to import it into postgres's db?
I no there is a command in psql can do it. But I forget.

in psql:

test=> \h copy
Command: copy
Description: copy data to and from a table
Syntax:
COPY [BINARY] class_name [WITH OIDS]
TO|FROM filename|STDIN|STDOUT [USING DELIMITERS 'delim'];

filename here is an absolute path in the backend's scope

Another option would be:

test=> \?
....
\copy table {from | to} <fname>
....

Here, <fname> should be in the path of your client. This requires the
file to be tab-delimited, while the backend copy allows you to use
other delimiters (not CSV, though). Be aware that if you use the
client copy (\copy), your data will go over the network.

--Gene

#4Stephen Boyle
yd80@dial.pipex.com
In reply to: Gene Selkov, Jr. (#3)
Re: [GENERAL] about copy

COPY � Copies data between files and tables
COPY [ BINARY ] table [ WITH OIDS ]
FROM { 'filename' | stdin }
[ USING DELIMITERS 'delimiter' ]
COPY [ BINARY ] table [ WITH OIDS ]
TO { 'filename' | stdout }
[ USING DELIMITERS 'delimiter' ]

-----Original Message-----
From: bluexiao <bluexiao@yeah.net>
To: postgreSQL <pgsql-general@postgreSQL.org>
Date: 18 July 1999 23:09
Subject: [GENERAL] about copy

Show quoted text

Hello:
I want to import some data from access97 to postgres, I have save
the data to .CSV file, but how to import it into postgres's db?
I no there is a command in psql can do it. But I forget.

=-=-=-=-=-=-=-=
Take care
=-=-=-=-=-=-=-=