Share data (Parameters) between datasets in SSRS 2005

  • I've a report with several Datasets.

    I'dd like to share data between datasets, to fill parameters.

    example:

    Dataset 1:

    use db1

    select debnr from site where name='customername'

    Dataset 2:`

    use db2

    select sitename from customer where sitename=@P_CCode

    I'dd like to fill @P_CCode with the data from debnr from db1

    Is this possible?

  • No need for a variable, at all...

    SELECT SiteName

    FROM db2.dbo.Customer c2

    INNER JOIN db1.dbo.Site s1

    ON c2.SiteName = s1.Debnr

    WHERE s1.Name = 'CustomerName'

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • I'm assuming you are using SQL Reporting Services. If that is correct then, yes, you can use the selection from query 1 to populate the parameter for query 2. I assume that query 1 is populating a parameter, let's call it SiteName. In your dataset for query 2 you need to go into properties and to the parameters tab and assign the report parameter SiteName to provide the value for the query parameter @P_CCode.

  • Yes, I'm using ReportServer and I'm using the parameters to make selections, so I need them.

    I'll try the method of Jeff, to fill my parameter.

    If it doesn't work, I'll come back.

    Thanks in advance.

  • htilburgs (1/20/2009)


    Yes, I'm using ReportServer and I'm using the parameters to make selections, so I need them.

    I'll try the method of Jeff, to fill my parameter.

    If it doesn't work, I'll come back.

    Thanks in advance.

    Jack must be a mind reader. I had no idea it was for reporting services. You should probably try his method, first. Mine was for straight-up T-SQL.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply