Variables to input in file name for Reporting Serv

2019-07-01 11:14发布

Is there a list anywhere that lists all the variables I can use in file names for report subscriptions from within SQL Server Management Studio? I currently use @timestamp in my file names, but would like to use other options or even remove parts of the time stamp (for example, just use the date, not the time).

1条回答
来,给爷笑一个
2楼-- · 2019-07-01 11:42

Unfortunately @timestamp is the only variable available. There are various workarounds for formatting @timestamp, but nothing that is simple. Here is a thread that explains one (but not the only) workaround: http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/81f47009-946a-4ebc-be43-7690236e829b

In case that link goes away, here were the recommendations:

To solve the issue, I would suggest using Data-Driven Subscription

A data-driven subscription provides a way to use dynamic subscription data that is retrieved from an external data source at run time. A data-driven subscription can also use static text and default values that you specify when the subscription is defined. We can use data-driven subscriptions to do the following:

Distribute a report to a fluctuating list of subscribers. For example, you can use data-driven subscriptions to distribute a report throughout a large organization where subscribers vary from one month to the next, or use other criteria that determines group membership from an existing set of users. Filter the report output using report parameter values that are retrieved at run time. Vary report output formats and delivery options for each report delivery. .

In this case, we can define the filename with timestamp in database and then use Data-Driven Subscriptions to delivey the report.

For more information about Data-Driven Subscriptions, please see:

For SQL Server Reporting Services 2005: http://msdn.microsoft.com/en-us/library/ms159150(SQL.90).aspx

For SQL Server Reporting Services 2008: http://msdn.microsoft.com/en-us/library/ms159150.aspx

查看更多
登录 后发表回答