Friday, March 9, 2012

Dynamically change datasource

Is it possible to dynamically change the datasource in a report? I have a database for each company and I don't want to have to replicate each report for each datasource.

Thanks,

Duncan

Moved to Reporting Services.|||

Hi Duncan,

If your databases are identical you can define them to the report server as linked servers, and build your sql statements for report datasets as dynamic sql statements.

Pass the linked server name as a parameter and use that parameter value in the dynamic sql.

Set data source as :

"Exec " & Parameters!LinkedServer.Value & "." & Parameters!DBName.Value & ".dbo.SampleStoredProcedureName " & Parameters!SampleParameterName.Value

|||

Also check this related thread: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=16395&SiteID=1

-- Robert

No comments:

Post a Comment