Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 parameters

Author  Topic 

aarthirsk
Starting Member

5 Posts

Posted - 2014-01-02 : 06:13:57
I have another requirement that the parameters should be independent of its execution.I have six parameters which should be independent of its execution.

I have done it using if else statements..

Six parameters are ticket no,order type,from date,to date,shpdateto,shpdate from.

I have stored the select statements inside variables to make sure which has to be executed in which case.

Used the same inside If --- else statements.

I have done like this...

if @fromdate is null and @todate is null and @ordertype <>''
begin
set @a = @x
end
else if @ticketno = '' and AND (@FromDate <> NULL AND @ToDate <> NULL) AND (@shpdatefrom = null and @shpdateto = null) and @OrderType <> ''
begin
set @a = @y
end
else if @ticketno = '' AND (@shpdatefrom IS NOT NULL and @shpdateto IS NOT NULL) AND @OrderType <> ''
begin
set @a = @z
end


My problem is if I give shpdatefrom and o values alone and leave the other columns blank im getting error saying one or more parameters need to be filled.

The same happens for from date and to date also.

Pls help me out...




visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2014-01-02 : 13:35:01
you need to check allow null value or allow blank value property for each of parameters in SSRS to make it optional.
For query behind you can use catch all method or dynamically build string based on passed parameter values

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



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -