Join SQL Server table in OPENQUERY on multiple keys I need to join an Oracle linked server table (with 1 billion rows) with an SQL Server table (with 100 rows) on multiple keys:

SELECT * FROM OPENQUERY(EDW, 'SELECT * FROM ORACLE_TABLE') A
INNER JOIN SQL_TABLE B
ON A.KEY1 = B.KEY1 AND A.KEY2 = B.KEY2
INNER JOIN SQL_TABLE C
ON A.KEY3 = C.KEY1 AND A.KEY4 = C.KEY2;


But ORACLE_TABLE is very huge and this query takes too much time to run. Is there a way to pass SQL_TABLE to OPENQUERY and do the join on the Oracle server?
OK, then think the other way around.  Something like the general outline:


Create a Linked Server from Oracle to SQL Server and SQL Server to Oracle.
From Oracle select the 100 rows of SQL Server data and store in a temporary table in Oracle.
Run the query in Oracle to join/filter/whatever the 1 billion Oracle rows by the 100 SQL Server rows in the temporary table to create the result set.
Use OPENQUERY from SQL Server to bring the results back to SQL Server.



INSERT INTO SqlServerTable 
  SELECT * FROM OPENQUERY (LinkedServerName, 'query text');



I likely missed some step, but this basic approach is to move the small amount of SQL Server data over to Oracle, run the query, and then read the result back to SQL Server.

EDIT:  At https://stackoverflow.com/questions/29200147/how-do-i-convert-an-oracle-timestamp-data-type-to-sql-server-datetime2-data-type Jon of All Trades showed how he converts an Oracle timestamp to a SQL Server datetime2.  

(I have no Oracle server to test against, however.)