Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Reporting Services and Subscriptions - Stop Sending Empty Report Expand / Collapse
Author
Message
Posted Thursday, June 25, 2009 11:24 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Thursday, December 4, 2014 10:09 AM
Points: 2,706, Visits: 3,427
We have a report that runs on a nightly basis that gets emailed out via subscription when the report is run. However, when there is no data in the report, it emails a blank report. We would not like for empty reports to be emailed out. Does anyone have a way to fix this?

Thanks,

Jared


Thanks,

Jared
SQL Know-It-All

How to post data/code on a forum to get the best help - Jeff Moden
Post #742045
Posted Thursday, June 25, 2009 3:20 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Monday, July 14, 2014 1:05 PM
Points: 386, Visits: 318
If its a job please try msdb.sp_send_dbmail
Post #742238
Posted Friday, June 26, 2009 8:06 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 8:26 AM
Points: 10,381, Visits: 13,436
There is no really good way to do this. Anyway you do it is a bit of a hack. The way I have done it is to create a sql agent job that checks for the existence of data for the report then us sp_start_job to fire off the job created by SSRS for the subscription if data exists. Like I said it's a hack, but it works.



Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming

Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
Post #742700
Posted Monday, July 27, 2009 4:57 AM
SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Tuesday, December 9, 2014 5:31 AM
Points: 4,429, Visits: 4,183
I maybe a little bit late with this reaction, but you might find this link rather useful:

http://blogs.msdn.com/bimusings/archive/2005/07/29/445080.aspx


Markus Bohse
Post #759959
Posted Monday, July 27, 2009 9:07 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 8:26 AM
Points: 10,381, Visits: 13,436
MarkusB (7/27/2009)
I maybe a little bit late with this reaction, but you might find this link rather useful:

http://blogs.msdn.com/bimusings/archive/2005/07/29/445080.aspx


It's never too late to provide a good resource, thanks Markus. Make sure you read the comments on that link as well as there are some good ideas there are well.




Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming

Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
Post #760153
Posted Tuesday, July 28, 2009 7:06 AM


Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Today @ 7:53 AM
Points: 680, Visits: 6,852
MarkusB (7/27/2009)
I maybe a little bit late with this reaction, but you might find this link rather useful:

http://blogs.msdn.com/bimusings/archive/2005/07/29/445080.aspx


Great link!
We have Data Driven subscriptions, with a master list of subscripbers, and another table for each report, with comments, parameters, etc.. Joined together, they make 'the list' for any scheduled subscription. We have a flag on the master list (Y/N) used to disable all subscriptions for a user. I could see adding a similar flag to the report table. Since most of our reporting is weekly, a job could easily be scheduled to update the flag prior to the scheduled run.
The one issue I see - if a blank report is sent, when you do have an issue, the user is likely to ask 'where is my report'. If it comes sporadically, you may not know you are having problems.
Greg E
Post #760712
Posted Tuesday, September 15, 2009 10:37 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, February 23, 2010 2:19 AM
Points: 1, Visits: 3
We have a report in Reporting Services. According to results it returns we want to manage recipients.
The problem is that Reporting Services generates a list of subscribers (recipients) BEFORE the actual procedure run. If we could change the sequence of those steps we could easily solve all issues (and many others) with empty reports are being sent to our subscribers (we could dynamically remove all unnecessary addresses from subscriptions).

Basically, it’s a kind of monitoring system which should be triggered every 1-2 mins. Report contain accounts, managers of those accounts and income those accounts make to us. If income goes below specific level it should be notified to that account manager.. We want to use Reporting Services subscriptions for this task (we want to attach Excel spreadsheet into e-mails and send this e-mail to account manager).

Any ideas how it can be solved?

thanks
Post #788357
Posted Monday, February 22, 2010 8:42 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, March 29, 2013 12:15 AM
Points: 5, Visits: 56
I got this to work by combining a few suggestions. I did not like the idea of hacking the Reporting Services tables, or subverting the normal scheduling. The suggestion to throw an error seemed the best, but did not make sense. Finally, I was able to create a stored procedure with a parameter that said whether to allow for an empty result set or not. Example:

CREATE PROCEDURE usp_getReportData @StartDate DATETIME = null, @EndDate DATETIME = null, @AllowEmptyReturn BIT = 1
AS
BEGIN
IF NOT Exists(SELECT TOP 1Data1, Data2 FROM DataTable
WHERE Data2 BETWEEN @StartDate AND @EndDate)
AND @AllowEmptyReturn = 0
BEGIN
RAISERROR ('No Records Found',16,1)
END
ELSE
BEGIN
SELECT Data1, Data2 FROM DataTable
WHERE Data2 BETWEEN @StartDate AND @EndDate
END
END
Post #870880
Posted Tuesday, April 9, 2013 7:15 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: 2 days ago @ 5:48 AM
Points: 1, Visits: 111
If for some reason you're unable to add/modify the dataset's stored procedure, you can add an additional dataset with the "IF" statement to throw the error. The effect appears to be the same.
Post #1440301
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse