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


Making parameters independent of its execution... very urgent requirement


Making parameters independent of its execution... very urgent requirement

Author
Message
aar.mba
aar.mba
SSC Rookie
SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)

Group: General Forum Members
Points: 28 Visits: 41
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...

Its very urgent requirement
sql Sarah
sql Sarah
SSC-Enthusiastic
SSC-Enthusiastic (149 reputation)SSC-Enthusiastic (149 reputation)SSC-Enthusiastic (149 reputation)SSC-Enthusiastic (149 reputation)SSC-Enthusiastic (149 reputation)SSC-Enthusiastic (149 reputation)SSC-Enthusiastic (149 reputation)SSC-Enthusiastic (149 reputation)

Group: General Forum Members
Points: 149 Visits: 590
You can set a parameter to allow nulls.

In the Report Data tab, right click on the Parameter name and choose Parameter Properties. The General screen has the option: Allow null value.
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