SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Parameter help


Parameter help

Author
Message
Briceston
Briceston
Ten Centuries
Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)

Group: General Forum Members
Points: 1032 Visits: 517
Hi,

I have a SSRS report with four parameters,and I want to be able to enter information for two of the parameters and run the report opposed to all four of them. However, when I select allow blanks and only select the parameters that I want to run the report by, the report comes back blank

Essentially, I want to be able to the run report by different parameters without having to enter information for all parameters at the same time.

What is the correct way of going about this?

Thanks!
Mark Fitzgerald-331224
Mark Fitzgerald-331224
SSCertifiable
SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)

Group: General Forum Members
Points: 5149 Visits: 1655
Briceston (10/29/2013)
Hi,

I have a SSRS report with four parameters,and I want to be able to enter information for two of the parameters and run the report opposed to all four of them. However, when I select allow blanks and only select the parameters that I want to run the report by, the report comes back blank

Essentially, I want to be able to the run report by different parameters without having to enter information for all parameters at the same time.

What is the correct way of going about this?

Thanks!


Please post the query for the dataset. If the report executes then the parameters are allowing blanks / nulls. Usually something like :

Select ...
From ....
Where Colour = @Colour

If @Colour allows blanks then only rows with blank '' will match.

Try:

Select ...
From ....
Where Colour = @Colour or @Colour = ''

Fitz
Briceston
Briceston
Ten Centuries
Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)

Group: General Forum Members
Points: 1032 Visits: 517
Mark, thanks for replying. Your example logic below was very helpful. After I introduced into my logic, the report runs fine.

Thanks.

Mark Fitzgerald-331224 (10/30/2013)
Briceston (10/29/2013)
Hi,

I have a SSRS report with four parameters,and I want to be able to enter information for two of the parameters and run the report opposed to all four of them. However, when I select allow blanks and only select the parameters that I want to run the report by, the report comes back blank

Essentially, I want to be able to the run report by different parameters without having to enter information for all parameters at the same time.

What is the correct way of going about this?

Thanks!


Please post the query for the dataset. If the report executes then the parameters are allowing blanks / nulls. Usually something like :

Select ...
From ....
Where Colour = @Colour

If @Colour allows blanks then only rows with blank '' will match.

Try:

Select ...
From ....
Where Colour = @Colour or @Colour = ''

Fitz




wolfkillj
wolfkillj
Hall of Fame
Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)

Group: General Forum Members
Points: 3976 Visits: 2582
Briceston (10/31/2013)
Mark, thanks for replying. Your example logic below was very helpful. After I introduced into my logic, the report runs fine.

Thanks.

Mark Fitzgerald-331224 (10/30/2013)
Briceston (10/29/2013)
Hi,

I have a SSRS report with four parameters,and I want to be able to enter information for two of the parameters and run the report opposed to all four of them. However, when I select allow blanks and only select the parameters that I want to run the report by, the report comes back blank

Essentially, I want to be able to the run report by different parameters without having to enter information for all parameters at the same time.

What is the correct way of going about this?

Thanks!


Please post the query for the dataset. If the report executes then the parameters are allowing blanks / nulls. Usually something like :

Select ...
From ....
Where Colour = @Colour

If @Colour allows blanks then only rows with blank '' will match.

Try:

Select ...
From ....
Where Colour = @Colour or @Colour = ''

Fitz





Hi Briceston and Mark Fitzgerald-331224,

The query Mark Fitzgerald-331224 suggested is an example of what's come to be called a "catch-all query". It can have a serious impact on the database performance. Here's a seminal article on catch-all queries that explains the problem and how to avoid it:

http://sqlinthewild.co.za/index.php/2009/03/19/catch-all-queries/

Jason Wolfkill
Blog: SQLSouth
Twitter: @SQLSouth
Mark Fitzgerald-331224
Mark Fitzgerald-331224
SSCertifiable
SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)

Group: General Forum Members
Points: 5149 Visits: 1655
Agreed WolfKillJ. I was providing a quick fix suggestion to the issue and would liked to have seen the dataset query to evaluate other options such as dynamic SQL as suggested in the linked article.

Fitz
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search