SQL Server Central is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
Search:  
 
 

Data Driven Subscriptions in SQL RS Standard

By Jason Selburg, 2006/05/23

Total article views: 115 | Views in the last 30 days: 5

As many of you know, data driven subscriptions is not a feature available with SQL 2000 RS Standard Edition. However, you can accomplish this using the supplied stored procedure. It may not be as pretty as the version in SQL Enterprise, but this one gets the job done, and it is very ……useful!

I have not included error checking and this SP only allows for one parameter. Feel free to modify the code as you see fit. Any suggestions or comments are welcome through this site or email me at HeroTheCat@indy.rr.com

Thank you, and I hope this helps....

1. Create a new subscription for the report that you want to set up a data driven subscription for. You can set the render type and delivery method however you want but you must use the following settings:
To Address: |TO| (pipe + TO + pipe)
Carbon Copy Address: |CC|
Blind Copy Address: |BC|
Reply To Address: |RT|
Comment / Body: |BD|
Parameter 1: |P1|

2. Now set the schedule of the report to run once.

3. Set the beginning date and ending date to a date prior to today to prevent the subscription from running unless you call it.

4. Retrieve the Job name from the SQL RS Database with the query below. Your subscription should be the first in the result set.

SELECT ReportSchedule.ScheduleID, Subscriptions.ModifiedDate
FROM Subscriptions INNER JOIN
ReportSchedule ON Subscriptions.SubscriptionID = ReportSchedule.SubscriptionID
WHERE (Subscriptions.Description LIKE N'%|TO|%')
ORDER BY Subscriptions.ModifiedDate DESC

5. To execute the subscription, simply call the stored procedure passing your values. Only the @scheduleID and @emailTO are required.

EXEC dbo.uspdata_driven_subscriptions
@scheduleID = '',
@emailTO = '',
@emailCC = '',
@emailBCC = '',
@emailReplyTO = '',
@emailBODY = '',
@param1 = ''

By Jason Selburg, 2006/05/23

Total article views: 115 | Views in the last 30 days: 5
Your response
 
 
Related tags
 
Already registered?  

Free registration required

To read the rest of this article, and access thousands of other articles, we ask you to register on the site and subscribe to our newsletters.

Register

E-mail address:
Password:
Password (confirm):

  

Subscriptions

We ask you to register on the site and subscribe to our newsletters. Subscribing to our newsletters gets you:

  • ALL of our content (thousands of articles, scripts, and forum postings)
  • A daily newsletter (example)
  • A weekly news round up (example)
  • The opportunity to ask and answer questions in our forums
  • A daily Question of the Day to test and help you increase your knowledge of SQL Server.

We ask that you give the newsletter a try for a week. Over 200,000 SQL Server Professionals a day find it entertaining and useful. If not, you are welcome to unsubscribe at anytime.

Steve Jones
Editor, SQLServerCentral.com