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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | 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
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ugh3012
Yak Posting Veteran

62 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
2241 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

62 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  
 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.04 seconds. Powered By: Snitz Forums 2000