﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Article Discussions / Article Discussions by Author / Discuss content posted by Mark Terry  / Report Subscription Dynamic File Names / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Sat, 25 May 2013 14:18:58 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Report Subscription Dynamic File Names</title><link>http://www.sqlservercentral.com/Forums/Topic931743-2708-1.aspx</link><description>I haven't had the oppertunity to do that (or read up if its a new feauture) so thanks, much appresiated!- @ukgavhttp://twitter.com/ukgav</description><pubDate>Wed, 08 Feb 2012 10:17:35 GMT</pubDate><dc:creator>UKGav</dc:creator></item><item><title>RE: Report Subscription Dynamic File Names</title><link>http://www.sqlservercentral.com/Forums/Topic931743-2708-1.aspx</link><description>I am going to try SQL 2012 to see if it is a new feature.</description><pubDate>Wed, 08 Feb 2012 08:17:53 GMT</pubDate><dc:creator>hkflight</dc:creator></item><item><title>RE: Report Subscription Dynamic File Names</title><link>http://www.sqlservercentral.com/Forums/Topic931743-2708-1.aspx</link><description>I would be awesome if you could include @ParameterName in subscriptions or filenames ... Come on Microsoft, make it so...</description><pubDate>Wed, 08 Feb 2012 06:23:30 GMT</pubDate><dc:creator>UKGav</dc:creator></item><item><title>RE: Report Subscription Dynamic File Names</title><link>http://www.sqlservercentral.com/Forums/Topic931743-2708-1.aspx</link><description>Only @TimeStamp and a couple other parameters like @ReportName work in that field.If you want to use a parameter to edit the file name, use my method and it should work. But it has been a while since I have looked at this stuff so maybe I am forgetting something.</description><pubDate>Fri, 03 Feb 2012 16:20:15 GMT</pubDate><dc:creator>markterry</dc:creator></item><item><title>RE: Report Subscription Dynamic File Names</title><link>http://www.sqlservercentral.com/Forums/Topic931743-2708-1.aspx</link><description>Hi Mark,In your post, you mentioned that for file based subscriptions you can simply include @TimeStamp in the file name field. I am trying to include a parameter in the filename using @ParameterName, but it simply appends '@ParameterName' to the file and does not use the parameter value.I am using SSRS 2008 R2. This would be a huge help. I am essentially trying to append an ID to each report and store it on our fileserver as a PDF. These are historical reports that only need to be created once a year.Thanks!</description><pubDate>Fri, 03 Feb 2012 13:53:05 GMT</pubDate><dc:creator>hkflight</dc:creator></item><item><title>RE: Report Subscription Dynamic File Names</title><link>http://www.sqlservercentral.com/Forums/Topic931743-2708-1.aspx</link><description>Has anyone else had success with this method? I always receive an Item not found error when the subscription runs if the path is altered in any way on SSRS 2008.</description><pubDate>Wed, 06 Oct 2010 10:03:21 GMT</pubDate><dc:creator>gcbohmann</dc:creator></item><item><title>RE: Report Subscription Dynamic File Names</title><link>http://www.sqlservercentral.com/Forums/Topic931743-2708-1.aspx</link><description>[b]Dynamically name report/file export in SSRS[/b]by Jason Selburg, 2010/03/22Article: [url=http://www.sqlservercentral.com/articles/Reporting+Services+(SSRS)/69546/]http://www.sqlservercentral.com/articles/Reporting+Services+(SSRS)/69546/[/url]Discussion: [url=http://www.sqlservercentral.com/Forums/Topic887162-304-1.aspx]http://www.sqlservercentral.com/Forums/Topic887162-304-1.aspx[/url]</description><pubDate>Thu, 24 Jun 2010 09:58:59 GMT</pubDate><dc:creator>markterry</dc:creator></item><item><title>RE: Report Subscription Dynamic File Names</title><link>http://www.sqlservercentral.com/Forums/Topic931743-2708-1.aspx</link><description>[quote] I did manage to find one article showing you how your could make a stored procedure to actually execute the report from, providing the parameters. However this only worked for one parameter, and was kind of a pain for a long term solution.[/quote]Please could you post your source for this?- Gav B.</description><pubDate>Thu, 24 Jun 2010 07:05:08 GMT</pubDate><dc:creator>UKGav</dc:creator></item><item><title>RE: Report Subscription Dynamic File Names</title><link>http://www.sqlservercentral.com/Forums/Topic931743-2708-1.aspx</link><description>The code I have written works well for my scenario but you may want to change it for yours. The main point is you need to change the path in the catalog table before the emails goes to what you want the filename to be, and you need to change it back afterwards so you can access the report via Report Manager. Other ways I thought of doing this was to try and hunt down the procedure called to run the report and change it before and after that code in that procedure. If you end up doing this please post so other can see how.</description><pubDate>Fri, 18 Jun 2010 11:58:02 GMT</pubDate><dc:creator>markterry</dc:creator></item><item><title>RE: Report Subscription Dynamic File Names</title><link>http://www.sqlservercentral.com/Forums/Topic931743-2708-1.aspx</link><description>Recently have updated my code as follows after a few errors at certain report subscription times:[code="sql"]/****** SCRIPT: UpdatePathsCreated: May 25 2010Created By: Mark TerryPURPOSE: The purpose of this procedure is to replace the Path in the catalog table for reports which are about to be distributed by email. It does this so that the filename of the attached report will have the date in the file name. In order for this to work it must be executed by a SQL Job every 15 minutes. During the 15 minutes that the path has been changed, you cannot access from report server directly as the path has been changed.REQUIREMENTS: You must setup a SQL Job on the same server as the ReportServer database to run every 15 minutes (unless timing changed) for this to work correctly. Tweaks: You can change the line Set Path = Path + ' ' +  CONVERT(Char(15), getdate(), 106) to Set Path = Path + ' ' +  Whatever you wantYou can change the timing by changing the between 0 and 15 ranges at the end of the procedure.Latest Updates: Changed the dates it is looking for as it didn't work over midnight runs.  ******/ALTER Procedure [dbo].[UpdatePaths] asBegin--This procedure updates paths for report subscriptions--the report subscription typically needs to be on a shared subscription for this to work. Maybe changing the dates I am looking at will make it workIF not EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE' AND TABLE_NAME='Catalog_Path') 	CREATE TABLE [dbo].[Catalog_Path](		[ItemID] [uniqueidentifier] NOT NULL,		[PriorPath] [nvarchar](425) NULL	) ON [PRIMARY]   Insert Into Catalog_Path (ItemID, PriorPath)Select ItemID, Path from Catalog Where Catalog.ItemID not in (Select ItemID from Catalog_Path)Delete from Catalog_PathWhere ItemID not in (Select ItemID from Catalog)UPDATE CatalogSet Path = PriorPathFROM  (SELECT	cp.ItemID as PastItemID,	cp.PriorPathFROM Catalog_Path cp)PastWhere Catalog.ItemID = PastItemIDAnd Path like '%' +  replace(Cast(YEAR(GetDate()) as varchar), '201', '1')And Catalog.ItemID in(Select ItemID FROM        	ReportSchedule rs            INNER JOIN subscriptions s                	ON rs.subscriptionID = s.subscriptionID            INNER JOIN dbo.[catalog] c                	ON rs.reportID = c.itemID    Inner Join Schedule sc	ON sc.ScheduleID = rs.ScheduleIDWHERE        sc.LastRunTime &amp;lt; GETDATE() and not(DATEDIFF(MINUTE,GETDATE(),NextRunTime) between 0 and 20OR DATEDIFF(MINUTE,GETDATE(),StartDate) between 0 and 20))UPDATE CatalogSet Path = Path + ' ' +  Replace(Replace(CONVERT(Char(11), getdate(), 106),'201', '1'),' ','')FROM  (SELECT	c.ItemID as FutureItemIDFROM        	ReportSchedule rs            INNER JOIN subscriptions s                	ON rs.subscriptionID = s.subscriptionID            INNER JOIN dbo.[catalog] c                	ON rs.reportID = c.itemID    Inner Join Schedule sc	ON sc.ScheduleID = rs.ScheduleIDWHERE        DATEDIFF(MINUTE,GETDATE(),NextRunTime) between 0 and 20OR DATEDIFF(MINUTE,GETDATE(),StartDate) between 0 and 20)FutureWhere Catalog.ItemID = FutureItemIDAnd Path not like '%' + Replace(Replace(CONVERT(Char(11), getdate(), 106),'201', '1'),' ','')END[/code]</description><pubDate>Fri, 18 Jun 2010 11:34:13 GMT</pubDate><dc:creator>markterry</dc:creator></item><item><title>Report Subscription Dynamic File Names</title><link>http://www.sqlservercentral.com/Forums/Topic931743-2708-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/scripts/Reporting+Services+(SSRS)/70387/"&gt;Report Subscription Dynamic File Names&lt;/A&gt;[/B]</description><pubDate>Wed, 02 Jun 2010 16:43:50 GMT</pubDate><dc:creator>markterry</dc:creator></item></channel></rss>