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
I'd use YYYY-MM-DD HHmmss for filenames, unless there is a particular need for timezones or a possible need to parse them into ISO dates; in those cases an ISO date would probably be preferrable.
You should use double quotes and need to evaluate date +"%F" using command substitution. Double quote helps you create a single file where some options of date command would include a space. For example, touch test_$(date) will create multiple files, where as touch "test_$(date)" won't.
Sample shell script to display the current date and time #!/bin/bash now="$(date)" printf "Current date and time %s\n" "$now" now="$(date +'%d/%m/%Y')" printf "Current date in dd/mm/yyyy format %s\n" "$now" echo "Starting backup at $now, please wait..." # command to backup scripts goes here # ...
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.
I have solved that problem using Data Driven Subscription. I found the solution here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With