Monday, March 12, 2012

Save file when report is run

Is it possible to save a report as a CSV when the report is run without the user having to export the file? I need to save the report to a server location without the end user having to specify where.

It sounds like you may be able to do what you require with a Subscription utilizing File Share Delivery:

http://technet.microsoft.com/en-us/library/ms159264.aspx

Larry Smithmier|||Not exactly. The CSV file needs to be created whenever the user runs the report. That will be at random times.|||

Then how about extending SSRS with a Custom Rendering Extension that renders the CSV and saves it to the file share? Here is information on creating a Rendering Extension:

http://msdn.microsoft.com/msdnmag/issues/05/02/CustomRenderers/

This might be overkill, but I believe it will work.

Another option may be to use a stored procedure to retrieve the data and 'trick' SSRS into doing a subscription on the fly and dumping the CSV to your share when the report is run. I came accross this article by Jason Selburg which claims to allow you to build your own data driven subscriptions using Standard Edition:

http://www.sqlservercentral.com/columnists/jselburg/datadrivensubscriptions.asp

and his follow up:

http://www.sqlservercentral.com/columnists/jselburg/2824.asp

Larry Smithmier

No comments:

Post a Comment