SQL server Reporting

I need to create reports for 4 specific scenarios in my project.The scenarios are represented as parameters in my report.Based on a scenario selection i need to call a stoired proc (i have 4 stored procs for each scenario).How can it be done .Any help will be appreciated.



Answer this question

SQL server Reporting

  • Justahobby

    Never done it

    but can you do this in your dataset (which is SQL)
    @parameter can be defined in "Report" item in toolbar -> Report parameters

    IF @parameter = 'A'
    EXEC sp_A

    IF @parameter = 'B'
    EXEC sp_B

    etc..
    I suppose you can do it in VB code in the report as well


  • David W Hart

    how sad, my reply didn't get the "Yes"

    EXEC SP_A @parameter_1, @parameter_2

    (the order has to be the same as defined in your SP)

    or you can do this (which may be better as order is irrelevant)

    EXEC sp_A

    @parameter_1_name = blah,

    @parameter_2_name = blah



  • MattiasJ

    Just create a new dataset under the data tab in Reporting Services and copy and paste the below and change the names to your stores procedures that's already in your database.

    IF @parameter = 'A'
    EXEC sp_A

    IF @parameter = 'B'
    EXEC sp_B

    When you run it the "Define Query Parameter" dialogue box comes up asking you for the parameter, and whatever you choose A or B you'll get the corresponding data.

    I just tried it and it worked!

    SK


  • GeoK

    Hi,

    That;s fine, but what if my INdividual procs require parametersi..e how do ispecify the parameters for SP_A and SP_B


  • Angela Zhou

    hi,

    But where do i specify this chunk of code I am looking at dynamic RDL generation as a solution.

    I have 3 drop downs in my app. the first DD corresponds to the SP name and the other 2 are the parameters for that particular procedure which is called.

    Now i suppose my question is clear

    Thanks a million 4 ur help


  • SQL server Reporting