Solved

Data-Driven Subscriptions for SSRS Reports with SQL 2008 Standard Edition

Posted on 2011-09-14
3
1,729 Views
1 Endorsement
Last Modified: 2012-06-27
I have a need to create a scheduled report via email (2x weekly).  This report would be received by a dynamic list of individuals that would be published in a SQL table.  Ideally, I would do this in Report Manager and use data driven subscriptions.  However, I am on SQL Server 2008 Standard Edition which doesn't enable this functionality.  Does anyone have a recommendation, or a script that may offer similar functionality?
1
Comment
Question by:goodmanro
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 25

Expert Comment

by:TempDBA
ID: 36540903
You can create a .net application that make use of the rdl and send mail to the list of users through db_mail using the list you have in your table stored.
0
 
LVL 11

Accepted Solution

by:
SThaya earned 500 total points
ID: 36541030
Hi,

  please refer the below link

http://msdn.microsoft.com/en-us/library/ms169673.aspx

OR

Try to use the below XQuery


Steps:

1. Deploy the RDL in the reportserver
2.  create a subscription with the To and CC .
3.  create a sechdule for only one time (it create a Subcription id in the SQL job)
4. create SP with the below code .
5. sechdule a SQL job

Code :


create PROCEDURE [dbo].[gsp_EmailXQUERY]  
--@FileNAme Varchar(75)    
AS    
 

BEGIN

--To DECLARE the Local Variable

DECLARE @PARAMETERVALUES XML,@VDate VARCHAR(250),@FILENAME VARCHAR(MAX),
@RDLPath VARCHAR(MAX),@ItemID VARCHAR(250),@SbscrptnID VARCHAR(250),@newSubject VARCHAR(MAX)

--To Get the RDL path from catalog table from ReportServer

SET @RDLPath ='/ Reports/SAB/SutdataEmail'

 
select  @newSubject =  'Report:SiteData'


 
--Exportfile with Extn
SET @FILENAME=@newSubject

--To Get the ItemID from catalog table from ReportServer

SELECT @ItemID =  [ItemID] FROM ReportServer.dbo.[Catalog]
WHERE PATH = @RDLPath

--To Get the SubscriptionID with the help of ItemID from catalog table

SELECT  @SbscrptnID = Sch.[SubscriptionID]    
FROM   ReportServer.dbo.[ReportSchedule] Sch WITH (NOLOCK)
WHERE [ReportID] = @ItemID

--To SET Extension SETtings for the particular ID

SELECT @PARAMETERVALUES = ExtensionSETtings
FROM ReportServer.dbo.[Subscriptions]
WHERE  [DeliveryExtension] = 'Report Server Email'
and SubscriptionID =@SbscrptnID

--Use X-Query to replace the existng values
 
SET @PARAMETERVALUES.modify('replace value of (/ParameterValues/ParameterValue/Value/text())[5] with sql:variable("@FILENAME")')

--Update the New File Name in [Subscriptions] table

UPDATE ReportServer.dbo.[Subscriptions]
SET ExtensionSETtings =CAST(CONVERT(XML,@PARAMETERVALUES,1) as NVARCHAR(MAX))
WHERE  [DeliveryExtension] = 'Report Server Email'
and SubscriptionID =@SbscrptnID

--To Fire-up and Event based on the subscription ID
 
EXEC REPORTSERVER.DBO.ADDEVENT @EventType='TimedSubscription',@EVENTDATA=@SbscrptnID


END
0
 

Author Closing Comment

by:goodmanro
ID: 36816772
Using SQL Server Enterprise version is the easiest option.  SThaya offers a nice work-around for SQL Server Standard above.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question