I am trying to access tables from two different linked servers. Basically from one server I get the list of id's and from the other linked server, I need to get two other columns whose id's match.
I tried to get the id's first from one server and populated it in an excel. After this, I took all the data from other server and wrote a vb macro to pick the matching rows. This actually takes lot of time, and at mos times, excel hangs as there are lot of content to compare actually. Is there a really simple solution for this?
I am trying for something like the below one, but facing issues to get the results.
select * from openquery([server1],
'select schema1.table1.col1, schema1.table1.col2 from schema1.table1 where schema1.table1.col1 exists
(select * from openquery([server2],'select schema2.table2.col1 from schema2.table2')')
Any help would be highly appreciated.
Thanks a lot in advance.