Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Is there a way to read data from PostgreSQL into a SQL Server View ?

I need to access some data in PostgreSQL from my ASP.NET app so I try to read from SQL Server view that already get data from PostgreSQL table.

Thanks in advance.

share|improve this question

closed as too broad by Kermit, OGHaza, Clockwork-Muse, Vladimir Oselsky, rene Apr 25 at 20:53

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

    
You'd need a way to create a "linked table" over ODBC, using the psqlODBC driver to connect to PostgreSQL. Research SQL server linked tables - pretty sure that's what you want. –  Craig Ringer Feb 2 at 13:37
    
thanks a lot, Is there a link explain the idea ? –  Mounir Feb 2 at 14:09
    
google.com.au/search?q=SQL+SErver+linked+table+postgresql ? (I've barely used SQL server, so all I'd be doing is searching and finding a good looking result.) –  Craig Ringer Feb 2 at 14:20
    
There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs. –  Kermit Feb 2 at 23:04
    
Why can't you just access Postgres directly? –  a_horse_with_no_name Feb 2 at 23:12

1 Answer 1

up vote 0 down vote accepted

It is pretty simple. Step one, download an odbc driver here, according to your system:

http://www.postgresql.org/ftp/odbc/versions/msi/

I found problems installing 09_03_0100 on a clean machine. I suggest 09_02_0100-x64.

Step 2, create an ODBC in System DNS, and test it: ODBC Configuration

Step 3, create a linked server: Linked server configuration

Step 4, query your linked server like this:

SELECT * FROM OpenQuery(PGEXAMPLE, 'select * from yourtable');
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.