0

I want to set up sending via email a SSRS report only when there is data in the report. It is actually an exception report which needs to send out only when there is an exception. The data for this is a stored procedure, and there are no parameters for this stored procedure. I just need to send the email with report when there is any data populated.

I tried the DDS in the SSRS but it did not work for me. Can anyone tell me how to do this ?

The stored procedure just returns results and does not update any table. There are two CTEs in the Stored procedure and the last line of the query is- select * from [desks_temporary_allocations_notifications][n] where dateadd(n,10,[notification_date]) > getdate()

This last part of the query returns values only when the where condition is met if the notification table is populated after 10 mins.

The result of this is mostly no rows. I set up a dds where for creating data set I need to write a query which I can't figure out which should only send a report when there is data in the report.

Can anyone help with this .

esinmal
  • 3
  • 2
  • Data Driven Subscriptions are exactly what you need. You shoud edit your question and explain `a.` why it "didn't work" `b.` how you configured your subscription `c.` does the SP just return results or update a table. Also look at this article https://www.mssqltips.com/sqlservertip/6382/sql-server-reporting-services-empty-report-from-a-data-driven-subscription/ – Alan Schofield Jan 24 '23 at 16:47
  • @AlanSchofield Thank you , I tried to edit my question, Can you check now and suggest something? Otherwise If you need more information pls let me know. – esinmal Jan 24 '23 at 21:30
  • Have a look at this. https://stackoverflow.com/questions/8560002/stop-empty-reports-from-being-sent-in-ssrs-2008-r2-data-driven-subscription There are lots of suggestions on how to achieve this. What you are trying to do it run a query that returns nothing when you don't want to run the report (you could even use you current SP and test if it returns anything) . The suggestions in the link are all about forcing an error when you don't want the report to run. I can't test as I don't have Enterprise edition but it looks simple enough. – Alan Schofield Jan 24 '23 at 22:39

0 Answers0