SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 Two SQL servers are not linked
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ugh3012
Yak Posting Veteran

59 Posts

Posted - 08/13/2013 :  15:26:25  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

India
2202 Posts

Posted - 08/14/2013 :  00:05:44  Show Profile  Reply with Quote
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

59 Posts

Posted - 08/14/2013 :  08:03:22  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000