Re: Automating record selection parameters



Hi Edgar,

How about:

Create proc rb_SubledgerRpt
@Acctcode varchar(4), @SubAcct varchar(3)
As
Select AcctCode, SubAcct
From GLDetails
Where SubAcct <> ' '
and ((@AcctCode = '*' ) or (AcctCode = @Acctcode))
and ((@SubAcct = '*' ) or (SubAcct = @SubAcct))

-*** Christoph
"Edgar" <edgarjtan@xxxxxxxxx> wrote in message
news:1141058639.691125.36720@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,

I need some advise on how to automate record selection on a stored
proc. Here is my situation. I have a stored proc that I used on
Crystal reports with two parameters - Acctcode and Subacct. When a
user enters ' *' on these parameter, it means to report on all
accounts otherwise, report only on specific account.

Here is my select statement with line numbers:

Create proc rb_SubledgerRpt
@Acctcode varchar(4), @SubAcct varchar(3)

As

3 Select AcctCode, SubAcct
4 From GLDetails
5 Where SubAcct <> ' '
6 and AcctCode = @Acctcode -- for specific acctcode
7 and SubAcct = @SubAcct -- for specific subacct

8 Go

-- If a user wants to see all Acctcode, and all Subacct, how do I
disable lines 6 and 7?

Thank you in advance for your help.

Edgar



.


Quantcast