all groups > sql server reporting services > june 2006 >
You're in the

sql server reporting services

group:

One server, many databases and stored procedures


Re: One server, many databases and stored procedures Bruce L-C [MVP]
6/22/2006 3:34:32 PM
sql server reporting services:
Yes, Go to RS 2005 which has support for this. There is no real clean way to
do this but if you absolutely must then you have to use expressions for the
query

="select * from some " & ...

But, I really recommend RS 2005. Note that if you want to stay with 2000
database RS 2005 can use 2000 for its object/metadata storage (but you do
have to have SQL Server 2005 license).


--
Bruce Loehle-Conger
MVP SQL Server Reporting Services


[quoted text, click to view]

One server, many databases and stored procedures ddaniels via SQLMonster.com
6/22/2006 7:08:35 PM
Hi -

I have a single database structure that will be implemented several times in
SQL Server 2000 to support multiple clients. I would like to have a single
instance of a report to use against all of these databases. I envision using
the connection string to control which database the report is using as its
datasource but I'm finding that Reporting Services for SQL Server 2000 doesnt
handle this.

I have seen other postinigs with this same problem. The popular response is
to pass the database as a parameter however, I'm using stored procedures and
Reporting Services doesnt support EXEC (or EXECUTE). Does anyone have any
other suggestions how I may handle this.

Thanks in advance.

--
Re: One server, many databases and stored procedures Kaisa M. Lindahl Lervik
6/23/2006 12:00:00 AM
You could try to have all stored procedures in one database, and query the
different databases from this stored procedure.

Have your report give a parameter for which client database you want to use,
and then have a case structure in your stored procedure.

Pseudoish code:
CREATE PROCEDURE [dbo].[HNDGetUsers]

(

@ClientID varchar(20),

@Parameter1 varchar(3)

)

AS

CASE

when @ClientID = 'Client1' then

SELECT [Client1Database].[Client1TableOwner].USERINFO.ID AS UserInfoID,
[Client1Database].[Client1TableOwner].USERINFO.NAME

FROM [Client1Database].[Client1TableOwner].USERINFO

WHERE ([Client1Database].[Client1TableOwner].EMPLTABLE.DATAAREAID =
@Parameter1)

when @ClientID = 'Client2' then

SELECT [Client2Database].[Client2TableOwner].USERINFO.ID AS UserInfoID,
[Client2Database].[Client2TableOwner].USERINFO.NAME

FROM [Client2Database].[Client2TableOwner].USERINFO


WHERE ([Client2Database].[Client2TableOwner].USERINFO.DATAAREAID =
@Parameter1)

end


RETURN

The statement might be syntactically wrong, but hopefully you get the idea.
You need to run the stored procedure as a user that has read rights in all
the databases you want to get data from.

Kaisa M. Lindahl Lervik
[quoted text, click to view]

Re: One server, many databases and stored procedures ddaniels via SQLMonster.com
6/23/2006 2:49:10 PM
Thank you both for your responses. I am trying to do it programmatically
through the API. There's a method that appears to change the datasource
contents. Hopefully I can get this working though most of the documentation
I'm finding refers to 2005.


[quoted text, click to view]

--
Message posted via SQLMonster.com
AddThis Social Bookmark Button