Re: Read MS-SQL data into Postgres via ODBC link?

From: "Brent Wood" <b(dot)wood(at)niwa(dot)co(dot)nz>
To: <JB(at)BlackSkyTech(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Read MS-SQL data into Postgres via ODBC link?
Date: 2011-07-05 00:58:15
Message-ID: 4E130A670200007B00040B28@gwia.niwa.co.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Jonathan,

I haven't done this from MySQL, but have from Postgres & from Oracle

From a command line client, extract the data from the source table, so you get a stream of csv style records.
Then pipe these directly into a psql statement to load them into the target table.

A simple pg2pg example:

psql -d $DB1 -F '|' -Atc "select * from table;" | psql -d $DB2 -c "copy table from STDIN with delimiter '|' with null '';"

A MySQL example would be similar, the second part pretty much identical.

HTH,

Brent Wood

Brent Wood
DBA/GIS consultant
NIWA, Wellington
New Zealand
>>> "Jonathan Brinkman" 07/05/11 12:45 PM >>>
Greetings

I'd like to INSERT data into my Postgresql 8.4.8 table directly from an
ODBC-linked MS-SQL table or view.

I'm looking at using the Cybertec tool "ODBC-LINK"
(http://www.cybertec.at/en/postgresql_products/odbc-link) but I'm wondering
if there isn't a way to do this through Postgresql directly?

I saw a post about someone doing a "SELECT * FROM XXX ODBC SOURCE" or
something like that
(http://archives.postgresql.org/pgsql-odbc/2009-07/msg00032.php) and that
would be cool. I don't need to import massive datasets, only 20-30K records
at a time.

Thanks much

Jonathan

--
Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Please consider the environment before printing this email.

NIWA is the trading name of the National Institute of Water & Atmospheric Research Ltd.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Johnston 2011-07-05 01:23:00 Re: Finding latest record for a number of groups in an INSERT-only table
Previous Message Daniel Farina 2011-07-04 23:48:06 Finding latest record for a number of groups in an INSERT-only table