Solved

SQL Report sent via email when user presses a button

Posted on 2007-03-21
4
507 Views
Last Modified: 2010-04-29
Hello,

I don't need a solution, I just need a starting point.  

When I run a report from SQL report manager I run it for a certain user (userid is a parameter for the report).   I have an application.  What I would like to happen is when a user hits a button in the application the report is sent to them in an email.   How should I do this?  Or can this even be done?

Thanks.
0
Comment
Question by:sarolabelle
[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
  • 2
  • 2
4 Comments
 
LVL 18

Expert Comment

by:chrismc
ID: 18769578
What I'm about to suggest is probably not going to be supported, advised or encouraged by Microsoft.
Also I've not tried this myself.

My idea is to create a subscription record on the fly in the Subscription table in the ReportServer database.
There is a CreateSubscription stored procedure in there which is obviously what report manager uses.
On reflection, I would suggest actually that Microsoft probably wouldn't have a problem with this as the procedure looks reasonably developer friendly.

There is also a DeleteSubscription to remove it at a later time.

So create the subscription to trigger in a minute or two. And log the Id of the subscription record somewhere, then have a cleanup task overnight, deleting these subscriptions.

Cheers
Chris

0
 

Author Comment

by:sarolabelle
ID: 18775681
Ok, great.  I did research and got as far as your last sentence.   How can I log the id and where?   If I save it in SQL then does the DeleteSubscription(subid) method work inside of SQL or perhaps I should create a service that runs at a certain time?  
0
 
LVL 18

Accepted Solution

by:
chrismc earned 500 total points
ID: 18775783
You need to keep track of the subscription your adding somehow. I'm not sure off the top off my head how you'll do this.

Looking quickly at the CreateSubscription procedure and Subscription table, the SubscriptionId id the field you need to keep track of - It's a GUID so I'm not sure how to grab it best after the insert. I'm sure there are  new features in 2005 to get whats just been inserted.
When you've got the id, just write it away in your own table.

Then write a procedure to run the DeleteSubscription for each SubscriptionId you've recorded and then delete it from your table. Whilst you'd create this as a procedure, you can then set a schedule to run this at an appropriate time. This is all standard SQL stuff, no need for extra services.
The SQL Server Agent is the service that manages the running of schedules.

Cheers
Chris
0
 

Author Comment

by:sarolabelle
ID: 18776292
Thank you!  This was just the little push I needed to get me started!  
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Hi, I am very much excited today since I'm going to share something very exciting Tool used for Analytical Reporting and that's nothing but MICROSTRATEGY. Actually there are lot of other tools available in the market for Reporting Such as Co…
Hello, In my precious Article  (http://www.experts-exchange.com/Database/Reporting/A_15280-Create-Project-in-Microstrategy-Part-I.html)we saw the Configuration part for Microstrategy which included Metadata Creation and DataSource Preparation as …
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

624 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