I have two queries visiting two different SQL Server to avoid Link Server Communication. First query get a List of OrderIDs, I use c# to organize them into a string that passes to the second query, like the following format:
Select .....
From .....
Where OrderID in (1,2,3,4,5,6)
-- 1,2,3,4,5,6 is the process from the result of first query.
I found if there are a lot orderIDs retrieved from the first query, the second query will timeout.
Is there any practice how many elements can pass to "IN" Clause?