1

My SSRS report has a dataset using this query

select c1, c2 
from t1 
where c3 = isnull(@parameter1, c3)

In the report, I set the parameter (@parameter1) to 'Allow null value' and default value to null. The parameter will from another data set.

I want the report to run automatically with the default null value parameter. But now the report is still waiting for the parameter to be selected to run. Why? Or how to achieve what I want?

P.S

Also please find attached screen shots for the parameter and the query. This is not exactly the same as in the description because I was just trying to demonstrate the issue. But you get the idea.

enter image description here

enter image description here

The query:

    select
    t.a, 
    t.b

    from
    (
    select 1 as a, 2 as b
    union all

    select 3 as a, 4 as b
    ) as t
    where t.a =isnull( @p, t.a)
thotwielder
  • 1,563
  • 7
  • 44
  • 83

2 Answers2

1

The query for the Available Values of your parameter needs to have a Null option for the default value of Null to be selected.

So your query that populates the parameter needs to something like

SELECT A, B
FROM MyTable
UNION ALL
SELECT Null AS A, '<All Values>' AS B
ORDER BY 2

where A is the Value and B is the Label.

Chris Latta
  • 20,316
  • 4
  • 62
  • 70
0

If Visual Studio shows default parameters well but SSRS site does not - DELETE the SSRS site report & deploy

Jairo
  • 1