SSRS: Do not send email if attachment is blank

  • Hi all,

    Is it possible to create a subscription in SSRS for SQL 2005 so that it only emails the subscriber if the attachment contains data?

    Dennis

  • I would use the No Rows property to display a custom message that will tell the users that there is no data.

    Email will be sent based on the subscription schedule, with an attachment but with your custom message when there is no data in the attachment.

    Hope this helps!

  • Hi,

    This is possible and is quite striaghtforward. All you need to do is create a data driven subscription.

    Follow the steps in the data driven subscription screen and fill in the details when you reach step 3 this where you need enter the sql command which will drive the report. This sql command will need to match the data in the report.

    Example:

    If your report is based on invoices raised on the previous day and is to be emailed to managers on a daily basis but you only want the report to be sent to them if invoices were raised the previous day. You don't want them to recieve a blank report.

    You would create the report as normal but only show invoices raised in the previous day.

    Then you would create a data driven subscription, when you reach step 3 your sql command will be as follows:

    Select * from tbl_invoices where invoice_date >=getdate()-1

    This will prevent the report from being sent if not data is returned by the query.

    Hope this helps.

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

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