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
 General SQL Server Forums
 New to SQL Server Programming
 Multi datasets from muli servers

Author  Topic 

tdorflinger
Starting Member

3 Posts

Posted - 2010-03-30 : 17:41:43
Hello, I am new to SQL Server with very limited programming in the past. I am trying to create a report in MS Server BIDS that uses 2 data sets that come from two seperate SQL servers. I have got as far as getting both data sources connected and and creating the SQL Querys to pull the data from each data set without much problem. My question is how I can now compare one set against the other to narrow down my report. Example: I need to compare the PortID from one set against the Name in the other and only show data for matches. Any advice, or am I going about this all wrong. Thank you so much in advance. Trent

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-03-30 : 23:33:38
I haven't done that type of thing in an SSIS package, but my recommendation would be to instead do this in a T-SQL query. You can link two database servers together in a single query using a linked server. You can then use this query in your SSIS package.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-03-31 : 00:11:47
I would populate 2 tables in the target server with the result sets from the remote servers and compare them there via T-SQL.
Go to Top of Page

tdorflinger
Starting Member

3 Posts

Posted - 2010-04-02 : 11:07:44
Thank you for the linked server hint. It turns out that there is an existing link to the target server. However I am now trying to query both at the same time with no luck. When I query only the linked server it works fine, but no matter how I try to query both I get a multitude of errors. I have found several recommendations on other sites, but none have worked out. Any more ideas? Thank you.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-04-02 : 11:15:59
quote:
Originally posted by tdorflinger

Thank you for the linked server hint. It turns out that there is an existing link to the target server. However I am now trying to query both at the same time with no luck. When I query only the linked server it works fine, but no matter how I try to query both I get a multitude of errors. I have found several recommendations on other sites, but none have worked out. Any more ideas? Thank you.


once you have linked server set up correct query will be as simple as

SELECT columns...
FROM Yourloacltable t
JOIN otherlinkedserver.database.schema.otherservertable t1
on t1.fields=t.realtedfields
....


not sure what error you're facing. if you post it, somebody might be able to help you in sorting it out

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -