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
 Development Tools
 Reporting Services Development
 1 report for 9 databases

Author  Topic 

bubberz
Constraint Violating Yak Guru

289 Posts

Posted - 2005-08-28 : 17:58:27
The web application I have has nine databases (and it's only going to get larger in number), and for each database we have the same report, but the dataset is set to that database's table.

What I'd like to do, and I'm almost sure it can be done, is look at the session object when the user logs into the application, and see which database they're using from a dropdown list they choose on the first page. With this db session object, I'd like to pass a parameter for the report to point to that database table. This way, I only have 1 report, rather than 9.

Is this possible? I can't imagine it isn't!

I've got the HitchHicker's Guide, and if it's in there, I'm totally overlooking it!

Thanks!

chriskhan2000
Aged Yak Warrior

544 Posts

Posted - 2005-08-29 : 15:18:06
Let me clarify what you are trying to do first. You have 9 databases with same schema, tables, fields, etc.. and just that it has different data right? Then you want to create just one report and have the user select one of the 9 databases from a drop down list?

If that is the case then it's very simple to do. If not then clarify it again or correct me.

This is what I had done. We have about 3 databases, one for each department of the business unit. The database is identical, except for the records contain in there.

Here's the steps to what I did:

1) In the Data section of Visual Studio 2003, this is what i have.


=IIF(PARAMETERS!SOURCE.VALUE = "Database1", "Database1.dbo.cw_report", IIF(PARAMETERS!SOURCE.VALUE = "Database2", "Database2.dbo.cw_report", "Database3.dbo.cw_report"))


So you can see "Database#" is the name of your database. It uses a conditional expression saying that if the user selects this database name, then do this else do that.

2) In your layout view, go to the properties at the right pane. Scroll down until you see ReportParameters. For name type in "SOURCE", and for prompt tye in whatever you want. Make sure that Non_queried under Available Values is selected. Then go into the fields and type in your databases for label and value.

Example:


Label Value

Database1 Database1
Database2 Database2
Database3 Database3


3) Make sure that you have your Stored Procedure or query in each database. I recommend SP since it is easier to work with especailly you will be having 9 databases. You can go to Preview to test it out.

Post if you have any questioins or what you want to do is different from what I told you.

Go to Top of Page

chriskhan2000
Aged Yak Warrior

544 Posts

Posted - 2005-08-29 : 15:20:09
BTW, I noticed you did this in a web page. You can probably do the same and pass it in as parameters from the web to the report.
Go to Top of Page
   

- Advertisement -