Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 Two SQL servers are not linked

Author  Topic 

ugh3012
Yak Posting Veteran

62 Posts

Posted - 2013-08-13 : 15:26:25
I have two servers that are not linked; therefore, I cannot create a stored procedure (or any other kind of query) to join two table from two different servers. What would be a best way to get a list of IDs from one table and use it to get a list from another table.

Below is a SQL I would have used if the two servers were linked.

Select B.ID,
Select A.Date,
From ServerA A
Inner Join Serber B B on A.ID = B.ID

I created a staging table to pull data from two different servers into one table. I want to be able to do something like this. The result will be put into the staging table.

Select A.Date
From ServerA
Where A.ID in (User::ListID )

User::ListID is name of package variable that contains the lists of IDs that was populated from Execute SQL task.


bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-08-14 : 00:05:44
If those two servers were liked, then you can use it directly...
SELECT A.ID, A.Date
FROM ServerA.DBName..TableA A
WHERE A.ID IN (SELECT ID FROM ServerB.DBName..TableB)

--
Chandu
Go to Top of Page

ugh3012
Yak Posting Veteran

62 Posts

Posted - 2013-08-14 : 08:03:22
quote:
Originally posted by bandi

If those two servers were liked, then you can use it directly...
SELECT A.ID, A.Date
FROM ServerA.DBName..TableA A
WHERE A.ID IN (SELECT ID FROM ServerB.DBName..TableB)

--
Chandu



They are not linked, so I cannot use this. I would had if it was linked.
Go to Top of Page
   

- Advertisement -