Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


joining multiple databases in one Sr...


joining multiple databases in one Sr...

Author
Message
Awannous87
Awannous87
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
Points: 3 Visits: 20
hi guys
I need help with an issue that I've got
scenario
I have multiple branches around australia with each branch having it's own db
each db contains the same information required for the branch itself
e.g.
branch a Has first name / last name
branch b has first name / last name
of course the fields have their own unique entries
e.g.
James in branch a
John in branch b
objective
creation of report in ssrs with a join of multiple databases
is it possible using an expression or anything else at all
thanks in advance to who ever can help me
Sean Lange
Sean Lange
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16636 Visits: 17024
If the databases are on the same server you can do this by using the full naming convention.

[database].[schema].[object]

If they are on different servers you will need to setup link servers and use 4 part naming.

[linkserver].[database].[schema].[object]

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Lowell
Lowell
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14973 Visits: 38994
you'll run into permissions problems accessing, say 10 databases in a single query;
the calling user would need at least read permissions in every single database for the specific table(s) involved..



i think you'll need to create a procedure, featuring EXECUTE AS with a user that has read permissions in all those databases, and then grant execute to that procedure to the groups that contain the users that will be using this report.

even better would be using a certificate, which i have no experience doing, but is the preferred way for permissions issues like this, i think.



--the EXECUTE AS must be a user in the database(s)...not a login
CREATE procedure pr_CallBoostedSecurityProcess
WITH EXECUTE AS 'superman'
AS
BEGIN
SELECT ColumnList FROM db1.dbo.Table1 UNION ALL
SELECT ColumnList FROM db2.dbo.Table1 UNION ALL
SELECT ColumnList FROM db3.dbo.Table1 UNION ALL
SELECT ColumnList FROM db4.dbo.Table1
END




Lowell

--
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Awannous87
Awannous87
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
Points: 3 Visits: 20
so it can be done...
I am getting a lot of people saying in Ssrs you can't connect more then one database per report
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search