由于我为此苦苦挣扎,并且无法通过简单的步骤找到好的在线资源,因此就在这里。
Run the following code in SSMS to create the linked server. This assumes a PostgreSQL instance on the local machine (hence localhost):
EXEC master.dbo.sp_addlinkedserver @server = N'POSTGRESQL', @srvproduct=N'Microsoft OLE DB Provider for ODBC Driver', @provider=N'MSDASQL', @datasrc='PostgreSQL', @location='localhost', @catalog='public'
Run the following code in SSMS to create a login mapping for the linked server:
EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'POSTGRESQL', @useself=N'False', @locallogin=NULL, @rmtuser='', @rmtpassword=''
Issue statements such as:
SELECT * FROM OpenQuery(POSTGRESQL, 'select my_column from my_table limit 10')
I had to use the double-quote
You can use PGNP OLE DB provider for PostgreSQL (pgoledb.com). See example on how to configure Linked Server at http://www.pgoledb.com/forum/viewtopic.php?f=4&t=6 ).
It is very high performance and scalable driver. We use it to work with tens of millions rows tables.
Regards, Carlos
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.