Dynamically assign stored procedure
I have a report that depending on what parameters the users selects can use one of three different sql stored procs. I figured out how to call the correct procedure by creating an expression for the data set, but the problem I have is the number of parameters each sp uses. One needs 7 parameters and one needs only 6 and the third only needs 5. When I run the report and call the sp that uses 7 parameters, eveything works fine, but I get a 'too many parameters' error when I try to use the sp that needs only 5 or 6 parameters. Is there any way to dynamically pass parameters to the sp? Thanks, Dan1104Dan1104
November 4th, 2010 10:25am

Well, you *could* create a 'master' procedure with 7 + 1 parameters. From the first 7 you make nr 6 and nr 7 optional, the last parameter is used as an indicator for what dataset you need. In this 'master' procedure you create 3 stored procedure calls (the 3 you mentioned in your question) and based on the indicator you execute one of them. I think that should work.M. Streutker, Info Support | Blog
Free Windows Admin Tool Kit Click here and download it now
November 4th, 2010 10:44am

Thanks, I thought that might be the road I have go down, I need to write this up for my boss for his approval and just need to be shure that there is not a way in ssrs to dynamically assign the parameters first. Thanks for your help Dan1104
November 4th, 2010 10:49am

Hi Dan, I usually solve this problem by making a 'wrapper' procedure as described above, but if somebody else has a better suggestion I'm all ears! Good luck, MarkM. Streutker, Info Support | Blog
Free Windows Admin Tool Kit Click here and download it now
November 4th, 2010 10:54am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics