SQL server reporting services: how to stop a report firing when opened

前端 未结 8 2291
悲&欢浪女
悲&欢浪女 2020-12-05 04:20

We have some SQL server reporting services reports. I didn\'t write then but I have to take care of them.

These reports fire when opened in the browser, and with the

8条回答
  •  温柔的废话
    2020-12-05 05:10

    I found a nice trick for this when working with reports that have optional fields, but pull a huge amount of data if the optional fields are blank.

    Step 1: Prevent Auto Firing

    • Make sure "Allow null value" is not enabled for the optional parameters
    • Make sure there is no default value for the optional parameters

    Step 2: Make parameters optional without using 'null'

    • Enable "Allow blank value" for the optional parameters
    • Modify your where clause for the optional parameters to WHERE (@param="" OR column = @param)

    With this method there is are extra fields for the end users to worry about, the report will not fire until it is requested, and the conditions in the where clause will not be evaluated if the text box is left empty.


    note: if the report specifies Available Values then any value that is not valid for your table structure may be used instead of "", you can also use with other data types (non-string) this way

提交回复
热议问题