Sorry for the repeat. I thought it didn't sent through, so I reply again.
THey're both the same. I've spent quite a while trying to figure this out,
"chang" wrote:
> We have that problem in the past, but got it to work now. You can use
> conditional expressions to get it to work.
>
> In the Data section, in the Generic Query Designer type this down.
>
> =iif(Parameters!Database.Value = "ACCT", "ACCT.dbo.SP_1",
> iif(Parameters!Database.Value = "HR", "HR.dbo.SP_1",
> iif(Parameters!Database.Value = "FIN", "FIN.dbo.SP_1", "ENG.dbo.SP_1")))
>
> This just says that if the parameter "Database" is "ACCT" then run SP_1 in
> that database, if parameter is "HR" then run SP_1 in HR database, etc.
>
> Now go to the Layout tab and click on the ReportParameters. Add a parameter
> and name it "Database". For Prompt you can use whatever. Make sure that
> "Non-queried" is selected and then type in the Label and Value.
>
> Example:
> Accounting, ACCT
> Human Resource, HR
> Finance, FIN
> Engineering, ENG
>
> That should get you going. Post if you have any more questions.
>
> Regards,
>
> Chang
>
>
> "Robert Bruckner [MSFT]" wrote:
>
> > It seems like you are missing a closing quote at the end of the expression
> > which would result in a compilation error during report publishing.
> > = "Exec " & Parameters!DatabaseName.Value & ".dbo.StoredProcedureName"
> >
> > --
> > This posting is provided "AS IS" with no warranties, and confers no rights.
> >
> > "GJ" <GJ@discussions.microsoft.com> wrote in message
> > news:FED73ED0-F9F1-4434-8D36-F2EA5044BD58@microsoft.com...
> > > Hi Eralper,
> > >
> > > Thank you for the quick reply. But I think I am confused now as how or
> > where
> > > to write those statements.
> > >
> > > The way I have been using reporting server is to create a dataset, create
> > a
> > > datasource in the dataset (or use a shared datasource), either write text
> > > query or exec SP there. Then write the parameters used in the query in the
> > > 'Report Parameters' tab in VS.NET.
> > >
> > > I am not sure if I followed it correctly, but if you are saying to create
> > a
> > > new DATASOURCE.. and write the source as:
> > >
> > > = "Exec " & Parameters!DatabaseName.Value & ".dbo.StoredProcedureName
> > >
> > > In my situation, that is giving me errors.
> > >
> > > On the other hand, running this " Exec
> > > [SqlServer1].Pubs.dbo.MyStoredProcedure " in the data tab in VS.NET
> > doesn't
> > > solve my problem as here we are giving DBName (Pubs) and that is static.
> > >
> > > What I am trying is ... create a pull-don menu in the report and give the
> > > user an option to select the particular database. Then the query is run
> > and
> > > results are returned for the query for the particular database selected.
> > >
> > > I may not have understood your explanation but am still confused.
> > >
> > > Thank you for your time and patience.
> > >
> > > GJ
> > >
> > > "eralper" wrote:
> > >
> > > > Hi,
> > > >
> > > > I'm using a similar method for maintaining many report servers on
> > different
> > > > locations and each connecting to their own databases.
> > > >
> > > > I use the below text as dataset source
> > > >
> > > > = "Exec " & Parameters!LSQLServerName.Value & "." &
> > > > Parameters!DatabaseName.Value & ".dbo.StoredProcedureName " &
> > > > Parameters!ParameterOne.Value
> > > >
> > > > LSQLServerName parameter is the Linked SQL Server. So even on the same
> > > > location you can change your sql server machine.
> > > > Note that you will not need this parameter if your reporting database is
> > on
> > > > the same server with your datasource. Otherwise you have to declare a
> > linked
> > > > server on the server running reporting server databases.
> > > >
> > > > DatabaseName parameter is the catalog name in the database server.
> > > >
> > > > Then you pass the query (or sp with parameters)
> > > >
> > > > Actually you send at the end a similar query:
> > > >
> > > > " Exec [SqlServer1].Pubs.dbo.MyStoredProcedure "
> > > >
> > > > I hope this helps.
> > > >
> > > > Eralper Yilmaz
> > > >
http://www.eralper.com > > > >
http://www.kodyaz.com/default.aspx > > > >
> > > >
> > > > "GJ" wrote:
> > > >
> > > > > I have 10 Databases with same query to extract same info from all
> > databases.
> > > > > One thing I can do is to create 10 different datasets to get my
> > results or
> > > > > join 10 queries in one big query.
> > > > >
> > > > > But what I really would like to do is to create one dataset and pass a
> > > > > database-name parameter so users can select the particular database
> > from pull
> > > > > down menu and view the results from that database. So basically it
> > will be
> > > > > running query for one database at a time. I tried to do it the same
> > way you
> > > > > create all parameters but of no use. I will appreciate any kind of
> > help.
> > > > > Example:
> > > > >
> > > > > Select manufacturer, sales
> > > > > From @DatabaseName.dbo.product FDP
> > > > > Where
> > > > > (DATEPART([Month], FDP.OrderDate) = @ReportMonth) and
> > > > > (DATEPART([Month], FDP.OrderDate) = @ReportYear)
> > > > >
> > > > > I can define and use @ReportMonth and @ReportYear but database name
> > > > > parameter @DatabaseName is not working.
> > > > >
> > > > > Thanks in advance.
> >
> >