I have a stored procedure that we use to pull information. In it there are some if statements that determine which information to pull based on the supplied parameter.
I am building a report in report builder to run this stored procedure. I have set the parameter in the report to default to one of the possibilities in the IF statements. However, the report is defaulting to the first select statement in the stored procedure, almost like it is skipping the IF statements.
How can I make sure it is going to the correct if statement in the stored procedure?
Thanks
A problem however that I do notice is the following: your stored procedure is not consistent in terms of fields returned. To be able to make it work in SSRS, your SP should always return a resultset with identical layout (field names, field types). That is currently not the case.