I will prefer to have data in SQL Server and then use it in the join within SQL Server and that way it returns result more faster. Try this, create a temp table in your proc, get the data from AS400 using OPENQUERY into temp table (this way you can have AS400 process your request instead SQL Server), and then use this temp table in join with sql server table....