Subject Re: [IBO] Simple parameter query question
Author Helen Borrie
At 11:56 AM 12/02/2007, you wrote:
>Not sure if this is a Delphi or IB question but here goes:
>
>I want a query that always obtains the same columns from a table/s,
>but which uses different parameters in different situations.
>
>Example 1:
>Return all rows
>
>Example 2:
>Customer ID = 44
>Document Type = 25
>
>Example 3:
>Customer ID = all
>Document Type = 25
>
>I know that one can create a paramter in a query and then reference it
> using parambyname, but how can I create a single query that will for
>example allow CustomerID
>sometimes to return "44" and sometimes to return all rows? What is the
>parameter for "all"?
>
>Really I'm looking for a way to use an "all" parameter so I can get
>all result permutations using only one base query by always passing
>all the possible parameters, rather than having to create lots of
>separate queries.

There is no "all" parameter! You get "all" if you don't include that
parameter in the limiting arguments.

Do you know about the SQLWhereItems feature in IBO? This doesn't
have the same economy of an always-prepared statement with a static
WHERE clause but it might suit your case anyway...

An alternative is to write a selectable SP to make your handling of
that dynamic parameter totally flexible by what you do with it inside the SP...

Helen