问题
I am generating report everyday through SSRS. I am trying to get current date as file name when ever the job runs and file created.
Like this ID_report_03-31-2014
I have tried echo %date% %time% and @ExecutionTime but it doesn't work
回答1:
The main option with a file share subscription is to add @timestamp
to the file name.
From File Share Delivery in Reporting Services:
An alternative approach to creating unique files for every delivery is to include a timestamp in the file name. To do this, add the @timestamp variable to the file name (for example, CompanySales@timestamp). With this approach, the file name is unique by definition, so it will never be overwritten.
I don't know if this is exactly what you are after, since it will include a time component, but as far as a standard SSRS subscription goes your options are limited.
Edit after comment
You don't have a lot of control over the format here.
On the MS forums one of there support suggests using Data Driven Subscriptions to get more control:
Can we edit @timestamp variable in SSRS:
In this case, we can define the filename with timestamp in database and then use Data-Driven Subscriptions to delivey the report.
But that seems a poor option to me, but is the only suggestion out there that I can see.
回答2:
I have solved that problem using Data Driven Subscription. I found the solution here.
来源:https://stackoverflow.com/questions/22823519/how-to-get-current-date-in-file-name