Whenever you add a select statement to SSRS, it by default usually adds your options for you if you insert a select statement, for example:
select thing from table where item = @Parm1
Then it should display the “Parameters” folder on the report designer screen in the “Report Data” section. If this parameter with a value does not exist, it must be added for your main body to work. Parameters are selected differently in SSRS, then in SQL. You define them in your section.
If you want it to ignore two parameters, why do you need to enable them? It seems a bit counter-intuitive. You have two options:
If variables are declared, set the default value for the static value.
Set the variable for 'allow nulls' and handle the null reference.
EDIT (with CTE below):
In SSRS, you do not do this (generally speaking, sometimes you may need a table variable, and this is normal or other static):
Declare @Var int; select thing from table where item = @Var
You just do this:
select thing from table where item = @Var
Then you process the Parameter parameter, because it has a property with a type and deterministic results.
I would just do it in SSRS Dataset:
with dates as ( select case @Q when 1 then '1/1/' + convert(varchar(10),@Year) when 2 then '4/1/' + convert(varchar(10),@Year) when 3 then '7/1/' + convert(varchar(10),@Year) when 4 then '10/1/' + convert(varchar(10),@Year) end as StartDate , case @Q when 1 then '3/31/' + convert(varchar(10),@Year) when 2 then '6/30/' + convert(varchar(10),@Year) when 3 then '9/30/' + convert(varchar(10),@Year) when 4 then '12/31/' + convert(varchar(10),@Year) end as EndDate ) select things from mainbodytable, dates
Make sure that you see the parameters listed for “Q” and “Year” in the “Parameters” folder and set them to integers. When the user runs the report, he requests these values, and they will determine the data set if they are valid values in the field. EG: they are not invalid values that return null values.