all groups > sql server reporting services > february 2005 >
You're in the

sql server reporting services

group:

Pulling data from two different servers


Pulling data from two different servers Jill
2/17/2005 11:45:01 AM
sql server reporting services: Hi,
I have some data I'd like to retrieve and run a report from, but the data is
one 2 different servers. I don't know how to set this up in report manager
or create a query that says something like
select server.database.field, differentserver.database.field etc.
Any help would be greatly appreciated.

Thanks
Re: Pulling data from two different servers Joel Rumerman
2/17/2005 12:00:37 PM
Jill,

The solution to your question lies solely within your SQL query and
Reporting Services will not affect how you solve this problem.

The easiest way to perform this task is to use a four-part query that
specifies the tables you want to pull from your remote server.

The format for the reference to the table is
"Servername.databasename.owner.table"

For example

select *
from myserver1.pubs.dbo.authors as A
join myserver2.pubs.dbo.titleauthor as B
on A.au_id = b.au_id

To perform this type of query you'll need to create a linked server. For
instance, if your connection is "myserver1" you need to create a linked
server on the myserver1 server to myserver2. If you Google "Linked Server
SQL Security" you will find articles instructing you how to do so. While
explaining the query is fairly straight forward, explaining Linked Server
security and permissions is best left up to people who have already written
about it.

Hope this helps.


[quoted text, click to view]

Re: Pulling data from two different servers Bruce L-C [MVP]
2/17/2005 2:34:22 PM
If you tables are large you need to be very careful with how you use the 4
part naming method of using linked servers. You can end up where an
incredible amount of data is brought locally to do the join. You are better
off to do this in two parts. First use openquery instead of 4 part naming.
Have two temp tables that two separate queries put their results into. Then
join the two temp tables together. The performance will be much much better.
If your tables are of any size I strongly recommend this approach (speaking
from painful learning experience).

--
Bruce Loehle-Conger
MVP SQL Server Reporting Services


[quoted text, click to view]

Re: Pulling data from two different servers Mike G.
2/17/2005 3:40:10 PM
While not as robust as the other solutions, you could also use a subreport
to accomplish the same thing.

Mike G.

[quoted text, click to view]

Re: Pulling data from two different servers Bruce L-C [MVP]
2/17/2005 3:58:11 PM
True. I should have mentioned this. If it is master/detail type of
relationship the subreports are the way to go.


--
Bruce Loehle-Conger
MVP SQL Server Reporting Services

[quoted text, click to view]

AddThis Social Bookmark Button