简体   繁体   中英

Manually Setting SSRS Report Subscription Parameters and Want to Set a Parameter to NULL

I am manually setting and running an SSRS report subscription. It has worked fine up until now, but I need to make a change to the report to set one of the parameters to NULL (this is a valid selection for the parameter to select "All" options of the parameter).

I cannot figure out how to pass the parameter into the XML so that it is set to NULL for the report execution. I can think of other workarounds by changing the report definition and underlying SQL queries, but was hoping to find a solution here first.

eg The below statement does not work as it is just an empty string.

UPDATE ReportServer.dbo.Subscriptions 
     SET parameters = '<ParameterValues><ParameterValue><Name>SomeParameter</Name><Value></Value></ParameterValue></ParameterValues>'
WHERE subscriptionid = @subscription_id

Found it out finally. I just needed to exclude the <Value></Value> section entirely from the XML and it treats that as NULL.

UPDATE ReportServer.dbo.Subscriptions SET parameters = '<ParameterValues><ParameterValue><Name>SomeParameter</Name></ParameterValue></ParameterValues>' WHERE subscriptionid = @subscription_id

I discovered this by manipulating the subscription to look the way I wanted in the user interface and then examining the XML from the database.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM