I'm working with SQL Server 2012 and SSRS. Using this very useful answer, I have a parameterized query working that pulls data from a DB2 system through openquery. I'd like to make this into an SSRS report. I don't see how to do it with a query, so I built a little stored procedure to wrap the query in, like so:
ALTER PROCEDURE dbo.QueryInfoByID
-- Add the parameters for the stored procedure here
@inputid varchar(10),
@outputfield varchar(50) output
AS
BEGIN
DECLARE @TSQL varchar(8000);
SELECT @TSQL = 'SELECT * FROM OPENQUERY(IMG2677,''SELECT outputfield FROM mytable WHERE outputfield = ''''' + @inputid + ''''''')'
EXEC (@TSQL)
END
How do I connect up the outputfield embedded in the @TSQL with the @outputfield in the output parameter list of the SP? I've tried some googling and can't find anything that addresses this. Apologies if this is a newbie question; I haven't done much with output parameters in stored procedures.