Click here to Skip to main content
15,914,013 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Everyone,

Could anyone explain, how to pass different database names as a parameter in SSRS report. I need to use 4 database names in my SSRS report to select appropriate database and fetch the desired report.
Posted

set a parameter with multiple values and those values would be name of database.

based on the name of database you get from your parameter, connect to each of your table to that DB, your SP will be a dynamic SP

e.g.

SQL
Create Proc GetValies(@DB as Nvarchar(50))
As
BEGIN
	Declare @SQL Nvarchar(max)
	set @SQL='select * from '+@DB+'.dbo.TableName'

	exec Sp_Execute @SQL
END
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900