I have several identifiers inserted in a temporary table #Aas follows:
SELECT DISTINCT ID
INTO
FROM LocalDB.dbo.LocalTable1
WHERE ID NOT IN (SELECT DISTINCT ID FROM LocalDB.dbo.LocalTable2)
GO
CREATE INDEX TT ON
GO
I am trying to get some information from a remote linked server using the identifiers that I collected in the previous step:
Request 1:
SELECT ID, Desc
FROM RemoteLinkedServer.DB.dbo.RemoteTable X
WHERE ID IN (SELECT ID FROM
Request 2:
SELECT ID, Desc
FROM RemoteLinkedServer.DB.dbo.RemoteTable X
INNER JOIN
ON X.ID = Y.ID
Now in the next query, I get the temp table output, copy the rows and format them correctly in a comma-separated list, and manually put it in the query.
Request 3:
SELECT ID, Desc
FROM RemoteLinkedServer.DB.dbo.RemoteTable X
WHERE ID IN (
1 2 2 , 3 0 ( 200 ). , , , , , , , , , - .
, , , ?