SQL Clone
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
Jared Karney
Jared Karney
SSC-Dedicated
SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)

Group: General Forum Members
Points: 36023 Visits: 3703
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
PFE - Microsoft
SQL Know-It-All
How to post data/code on a forum to get the best help - Jeff Moden
rajganesh.dba
rajganesh.dba
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1598 Visits: 323
If its a job please try msdb.sp_send_dbmail
Jack Corbett
  Jack Corbett
SSC Guru
SSC Guru (104K reputation)SSC Guru (104K reputation)SSC Guru (104K reputation)SSC Guru (104K reputation)SSC Guru (104K reputation)SSC Guru (104K reputation)SSC Guru (104K reputation)SSC Guru (104K reputation)

Group: General Forum Members
Points: 104727 Visits: 15049
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
Consultant Straight Path Solutions
Dont 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 QuestionHow 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
SSC-Insane
SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)

Group: General Forum Members
Points: 21915 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
SSC Guru
SSC Guru (104K reputation)SSC Guru (104K reputation)SSC Guru (104K reputation)SSC Guru (104K reputation)SSC Guru (104K reputation)SSC Guru (104K reputation)SSC Guru (104K reputation)SSC Guru (104K reputation)

Group: General Forum Members
Points: 104727 Visits: 15049
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
Consultant Straight Path Solutions
Dont 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 QuestionHow 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
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10969 Visits: 8767
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
Valued Member
Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)

Group: General Forum Members
Points: 51 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
Valued Member
Valued Member (59 reputation)Valued Member (59 reputation)Valued Member (59 reputation)Valued Member (59 reputation)Valued Member (59 reputation)Valued Member (59 reputation)Valued Member (59 reputation)Valued Member (59 reputation)

Group: General Forum Members
Points: 59 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
SSC Rookie
SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)

Group: General Forum Members
Points: 48 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