IIF in where clause to exclude selection criteri when null

From: baz (anonymous_at_discussions.microsoft.com)
Date: 06/23/04

  • Next message: Vishal Parkar: "Re: IIF in where clause to exclude selection criteri when null"
    Date: Tue, 22 Jun 2004 17:47:31 -0700
    
    

    Hi all,

    I've got a huge Reprot in Crystal 8.5.

    I've discovered that I can't work with the report if I
    change the Stored Proc the report is based on. (this is
    a kown and popular issue )

    SO what I want to do in save the report under a different
    name as attempt a more latteral approach by changing the
    Stored Proc instead.

    The original report criteria limits on AcctNum

    What I want to do is be able to exlude AcctNum from the
    selection criteria if its "ALL"

    Original stored proc:

    Select * from a
    WHERE
    AcctNum = @AcctNum
    AND
    a.FISCYR + a.FISCPER <= @year + @period

    --------

    What I want to do is something like this:

    Select * from a
    WHERE
    iif( @AcctNum = "ALL", , "AcctNum = " + @AcctNum + "
    AND " )
    a.FISCYR + a.FISCPER <= @year + @period

    Any suggestions?

    Thanks,
         baz
       


  • Next message: Vishal Parkar: "Re: IIF in where clause to exclude selection criteri when null"

    Relevant Pages

    • Re: Reflexive table problem - tricky
      ... Have you considered calling the stored proc directly from the ... >> as Input to a Crystal Report. ... >> procedure but a table Function wont let me call the Procedure so I am ... >> ID int PRIMARY KEY, ...
      (microsoft.public.sqlserver.programming)
    • Parameter fields order changes
      ... I have a report which accepts 2 stored proc parameter fields A ... The report has been verfied each time the order was changed. ... but an SQL server error is always raised. ... It seems that CR still retains the parameter order somewhere. ...
      (microsoft.public.vb.crystal)
    • Re: Help!
      ... > I have a Crystal report that calls a SQL Server stored proc. ... Then I added a subreport in the Report Footer ...
      (microsoft.public.vb.crystal)
    • Re: Calculated Columns vs Calculations in stored procs.... what is the best way ???
      ... > I have several crossTab type reports in a VB app. ... > data directly from a stored proc I have created on SQL Server 2000 ... > (this report clearly depends on REPORTA) ... > app and I dont really wanna do that.... ...
      (microsoft.public.dotnet.framework.adonet)
    • Crystal Report.Net DB Issue
      ... 1.)A report created in VS.Net 2003 using the CR.Net component of VS 2003. ... 3.)The Stored Proc has two input parameters of type date. ... 6.)The app that the report is in uses the Crystal Viewer Control to display ...
      (microsoft.public.dotnet.general)