Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Reporting Services and Subscriptions - Stop Sending Empty Report


Reporting Services and Subscriptions - Stop Sending Empty Report

Author
Message
SQLKnowItAll
SQLKnowItAll
SSCrazy
SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)

Group: General Forum Members
Points: 2798 Visits: 3681
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
rajganesh.dba
rajganesh.dba
Old Hand
Old Hand (394 reputation)Old Hand (394 reputation)Old Hand (394 reputation)Old Hand (394 reputation)Old Hand (394 reputation)Old Hand (394 reputation)Old Hand (394 reputation)Old Hand (394 reputation)

Group: General Forum Members
Points: 394 Visits: 323
If its a job please try msdb.sp_send_dbmail
Jack Corbett
  Jack Corbett
SSChampion
SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)

Group: General Forum Members
Points: 11018 Visits: 14858
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
At best you can say that one job may be more secure than another, but total job security is an illusion. -- Rod at work

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
MarkusB
MarkusB
SSCarpal Tunnel
SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)

Group: General Forum Members
Points: 4449 Visits: 4208
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
Jack Corbett
  Jack Corbett
SSChampion
SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)

Group: General Forum Members
Points: 11018 Visits: 14858
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
At best you can say that one job may be more secure than another, but total job security is an illusion. -- Rod at work

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
Greg Edwards-268690
Greg Edwards-268690
SSC Eights!
SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)

Group: General Forum Members
Points: 817 Visits: 8259
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
ikubrakov
ikubrakov
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 28
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
Adam Cuninghan
Adam Cuninghan
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
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
kcleary
kcleary
Forum Newbie
Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: General Forum Members
Points: 2 Visits: 191
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.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search