June 25, 2009 at 11:24 am
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
Jared
CE - Microsoft
June 25, 2009 at 3:20 pm
If its a job please try msdb.sp_send_dbmail
June 26, 2009 at 8:06 am
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
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
July 27, 2009 at 4:57 am
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
[font="Verdana"]Markus Bohse[/font]
July 27, 2009 at 9:07 am
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
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
July 28, 2009 at 7:06 am
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
September 15, 2009 at 10:37 am
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
February 22, 2010 at 8:42 pm
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
April 9, 2013 at 7:15 am
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.
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply