Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSRS subscription - change the date format (@ExecutionTime) on the subject line

Problem: The default subject line in an SSRS subscription email uses the @ExecutionTime pre-defined variable and at runtime replaces the same with a datetime in mm/dd/yyyy hh:mm:ss format. Since, we have deployed our product for an Indian client, we would like the date format in dd/mm/yyyy format.

Most of the posts on the internet have suggested using data-driven report subscription to construct a custom email subject. But as per SQL Server documentation, this feature is available in Enterprise and BI editions only.

Other attempts to use =Parameters!ExecutionDateTime or =FORMAT(@ExecutionTime,"dd-MMM-yyyy") or =format(Globals!ExecutionTime , "MMM yyyy") have failed.

Two days of futile attempts in solving this. Will continue looking, and hope the SO community can help.

like image 320
Tushar Sood Avatar asked Nov 28 '25 18:11

Tushar Sood


1 Answers

In addition to the answer by Tushar Sood, I would like to add that: the language can be made to work for subscriptions added after changing the language settings.

This can be achieved by doing the following steps in the reporting database:

  1. Go to the SQL server which is hosting your Reporting Services
  2. Open the SQL Server Management studio and go to a database called "ReportServer"
  3. Expand database "Reportserver"
  4. Expand Tables
  5. Open the table called "dbo.Subscriptions" in Edit Mode...You will see a column called "Locale"

For some reports which is showing "M/d/yyyy" format the locale will be set to value "en-US".

  1. Change the value to "en-GB"

Now all your reports (including old ones) using @ExecutionTime will start showing date time in "en-GB" format.

That's it... Happy Reporting!!!

like image 70
Alvin D'Souza Avatar answered Dec 02 '25 01:12

Alvin D'Souza



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!