1 year ago

#377592

test-img

user3191894

Join LinkedServers

Joins are one of my weak points; I am never sure how to use them and this one is within an Openquery

This works when DBs are on the same Server:

SELECT top (100) FROM LocalDBl.dbo.LocalTable1
LEFT JOIN LocalDB2.dbo.LocalTable2 ON LocalTable1.id = LocalTable2.ID;

LocalDB2 was moved so trying to use linked Server

SELECT * FROM OPENQUERY([linkedServeronLocalDB1],'
SELECT TOP (100) FROM  LOCALDB1.dbo.TABLE1
LEFT JOIN REMOTE_DB.RemoteTable ON Table1.ID=RemoteTable.id');

I get "Deferred prepare could not be completed" and sometimes not in sys.servers though it is there?

Any input is Appreciated

sql-server

linked-server

0 Answers

Your Answer

Accepted video resources