Pass linked report a stored procedure variable value?

(4 posts) (2 voices)

Tags:

No tags yet.

  1. -nth-, Member

    I've got a report that I'd like to calculate a variable value and then pass that to a linked report's parameter. I know that I can use a report column value by passing the column number like this:

    SELECT 'dbr.report','sp_DBR_linkedreport1','LinkedReport1','parameter=1';

    Or use an initial sproc parameter like this (add the negative sign):
    SELECT 'dbr.report','sp_DBR_linkedreport1','LinkedReport1','parameter=-1';

    But I'd like to do something like this:
    SELECT 'dbr.report','sp_DBR_linkedreport1','LinkedReport1','parameter=@myvariable';

    By this doesn't work. Is there a way to accomplish this?

    Thanks!

  2. myDBR Team, Key Master

    Include the variable into the select and use the normal report column value reference. You can hide the column from the output. As it is a variable, there is no need to change the query otherwise.

    --
    myDBR Team

  3. -nth-, Member

    OK, thanks. This particular report is a chart and involves several unions and nested selects so I was hoping to keep from adding additional complexity to it.

  4. myDBR Team, Key Master

    As said, adding variables to a query does not add complexity to the query. You just add them to the end of the select list. No need to take them into account anywhere else in the query (group by or elsewhere).

    --
    myDBR Team


Reply

You must log in to post.