>From: pgsql-general-ow...@postgresql.org 
>[mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Jonathan Brinkman
>Sent: Tuesday, July 05, 2011 7:48 AM
>To: pgsql-general@postgresql.org
>Cc: 'Brent Wood'
>Subject: Re: [GENERAL] Read MS-SQL data into Postgres via ODBC link?
>
>Thanks
>I'm importing into Postgresql 8.4.8 from MSSQL 2005.
>
>I do not have control over the MSSQL server, it is at a customer's site. I 
>only have access to read-only views on their server, from which I replicate 
>the data to my postgres staging tables.
>
>I cannot have the MSSQL server do anything like create .csv files, since it's 
>not my server and the customer will not do that kind of thing (or create DTS 
>scripts, etc. from the PUSH side).
>
>I'm hoping there is a way I can simply SELECT from an ODBC source and use that 
>SELECT as part of a Postgres INSERT statement.

>I don't use MySQL for anything.

>Thanks much for your response!
>
>J

Just connect to both databases (in Perl or Python, or something), do a select 
on the MSSQL data on the MSSQL handle.  When you get the row into a set of 
column variables, just insert the columns via the Postgres handle into the 
Postgres database.  Simple as pie.  You can prepare the INSERT statement so 
that multiple executions use bind variables.  Commit every 1000 rows or 
whatever.

Susan

Reply via email to