How to call a SSRS report from Stored Proc

  • Sorry if this is a basic question but I'm new to SSRS.

    I've created a basic report that calls a Stored Proc (SP) taking in an Account number as a parameter and that works fine. What I need to do now is something like running a SQL Job that calls an SP. That SP will get all the Account numbers and email addresses associated with them out of a table I'll create and manually populate. Then loop through that recordset and for every Account number it would pass the account number to the report, run the report, and then send an email to the recordset's email address with a PDF of the report attached to it.

    Can someone point me in the right direction on how to do something like that? Any examples or articles would be great.

    Thanks....

  • dcaver (1/30/2012)


    Sorry if this is a basic question but I'm new to SSRS.

    I've created a basic report that calls a Stored Proc (SP) taking in an Account number as a parameter and that works fine. What I need to do now is something like running a SQL Job that calls an SP. That SP will get all the Account numbers and email addresses associated with them out of a table I'll create and manually populate. Then loop through that recordset and for every Account number it would pass the account number to the report, run the report, and then send an email to the recordset's email address with a PDF of the report attached to it.

    Can someone point me in the right direction on how to do something like that? Any examples or articles would be great.

    Thanks....

    To do something like this, you would create data-driven subscription(s). Read up on the subject...I am sure you will find the necessary to achieve the above.

    Hope this helps.

    Martin.

  • From what I remeber this requires SQL Server Enterprise Edition which I don't have. Is this the only way to do it?

  • dcaver (1/30/2012)


    From what I remeber this requires SQL Server Enterprise Edition which I don't have. Is this the only way to do it?

    Not sure about whether it is only an Enterprise Edition feature, but it is the only (easy) way to do it from a Reporting Services point of view. Any other way would require lots of custom code which I don't think is worth the effort.

    I suppose you could do something similar with SSIS, but extracting the data and populating Excel files. PDF's would be another challenge which may require a lot of extra work....if it works.

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

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