June 25, 2013 at 10:25 pm
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
June 26, 2013 at 8:26 am
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 Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
June 26, 2013 at 8:29 am
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
June 26, 2013 at 2:54 pm
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
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply