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

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: Read MS-SQL data into Postgres via ODBC link?
Дата
Msg-id 77273381-1B0B-463D-BDAF-329F248959B2@solfertje.student.utwente.nl
обсуждение исходный текст
Ответ на Re: Read MS-SQL data into Postgres via ODBC link?  (Susan Cassidy <scassidy@edgewave.com>)
Ответы Re: Read MS-SQL data into Postgres via ODBC link?
Список pgsql-general
On 5 Jul 2011, at 23:27, Susan Cassidy wrote:

> >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
theirserver, 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
notdo 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.
Whenyou 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
every1000 rows or whatever. 

For those queries you will need a similarly prepared Postgres equivalent of the database schema of course, and quite
possiblysome conversions from MS-SQL types to Postgres types. It's quite obvious, but mentioning it doesn't hurt
anyone,and there could be some caveats in that process. Both databases are fairly SQL compliant though, it's probably
aneasier conversion than from the mistakenly assumed MySQL from earlier replies :P 

Alban Hertroys

--
If you can't see the forest for the trees,
cut the trees and you'll see there is no forest.


!DSPAM:737,4e139a9a12091547611509!



В списке pgsql-general по дате отправления:

Предыдущее
От: Susan Cassidy
Дата:
Сообщение: Re: Read MS-SQL data into Postgres via ODBC link?
Следующее
От: "Jonathan Brinkman"
Дата:
Сообщение: Re: Read MS-SQL data into Postgres via ODBC link?