Automating reports with ssrs subscriptions

9,077 views
8,541 views

Published on

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
9,077
On SlideShare
0
From Embeds
0
Number of Embeds
8
Actions
Shares
0
Downloads
69
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Automating reports with ssrs subscriptions

  1. 1. SQL Server Reporting Services subscriptions are an easy way to automatically run and deliver SSRS reports. You canschedule reports to run at a regular interval and deliver to file share, e-mail, or a SharePoint document library (if you’reusing SharePoint integration mode).HOW IT’S DONE:Here is my SSRS 2008 R2 instance, with a couple of prepared reports:I’m going to create a subscription for SSRS_example_multivalue, which has a parameter with multiple values to selectfrom.STOP!Before you run away with the subscription, you need to make sure that SQL Server Agent is running. C hances are yourSQL Server Agent isn’t running, so you won’t be able to run any subscriptions. You can start SQL Server Agent throughSQL Server C onfiguration Manager:Microsoft has steps on how to start SQL Server Agent if you’re curious.STARTING ON THE SUBSCRIPTIONRight-click on the report that you want to add the subscription to. Select Manage.
  2. 2. Next, go to Subscriptions. When the subscription list loads, if the button to add a New Subscription has a warning icon,you won’t be able to add a subscription just yet.Regular reports that use databases for the data sources need to have the credentials stored with the report. You will getan error message if you try to add a subscription. So let’s see how to fix that issue.MODIFYING THE DATA SOURCEGo to Data Sources.In my example, I’m using the AdventureWorks database, which is normally configured to use Windows integrated security.I’m going to switch to Credentials stored securely in the report server:
  3. 3. After adding the credentials, make sure to test your connection. I had to check-off Use as Windows credentials whenconnecting to the data source, but then I was able to connect to the database.C lick Apply when you’re done.GOING BACK TO THE SUBSCRIPTIONNow New Subscription should be free of the warning icon.You may notice that there are two types of subscriptions.
  4. 4. Data-drive subscriptions are available in the Evaluation, Developer, or Enterprise editions of SSRS. They providemore dynamic functionality at run time, such as picking the report recipients based on a query. Jes Borland (@grrl_geek)breaks down how to do data-driven subscriptions to a file share and e-mail in a couple of blog posts.For this example, I will focus on regular subscriptions.C lick New Subscription. You will be directed to the Report Delivery Options form.DELIVERY METHODThe first thing is to select the delivery method. If you are using SSRS in native mode, you can deliver to a file share or ane-mail account. You should note that e-mail delivery requires additional configuration. For simplicity, I’ll use the file sharefor my example.Select Windows File Share and specify the path to the shared folder.
  5. 5. It is important to note that the account that is running the report (see below) has WRITE permissions to the shared folder.RENDER FORMATAll the rendering extensions from the SSRS installation are available as export options. For this particular report, I’m goingto export to XLS using SSRS’ native Excel export option.Subscriptions also work with OfficeWriter‘s Excel and Word export options. I’ll briefly cover that later.CREDENTIALS AND OUTPUT OPTIONSAs mentioned above, the account running the report must have WRITE permissions in the shared folder. Additionally, thereare some options for writing out the reports. I opted to have unique numbers appended to the reports, to avoidoverwriting existing files.SUBSCRIPTION SCHEDULETo specify the subscription schedule, click Select Schedule under Subscription Processing Options.
  6. 6. For this example, I created a schedule that runs the report every 2 minutes starting about 10 minutes from the time Icreated the subscription. Realistically, you would want to schedule the report to run once a week or month etc.REPORT PARAMETER VALUESBecause this isn’t a data-driven subscription, I have to hard-code which values to use when running the report.
  7. 7. C lick OK when you’re done.CONGRATS! YOU’RE DONE!You should see your new subscription in the subscription list:SUBSCRIPT IONS WIT H OFFICE WRIT E RYou can also create subscriptions with the OfficeWriter renderers for Excel and Word. When setting up the subscription,just select Excel designed by OfficeWriter or Word designed by OfficeWriter.SUCCE SS:
  8. 8. I also created a subscription that uses the OfficeWriter for Excel renderer (ExcelWriter_SSRS_example.xlsx). Now goautomate those reports.

×