Subject | Re: Is there a parameter value of 'don't care' ? |
---|---|
Author | mspencewasunavailable |
Post date | 2007-01-11T16:22:23Z |
--- In firebird-support@yahoogroups.com, "tickerboo2002"
<egroup@...> wrote:
Where ((Co_Name = :Co_Name) or (:Co_name = '<<ANY>>'))
and ((town = :town) or (:town = '<<ANY>>'))
and ((Num_employees=:Num_Employess) or (Num_employees = -1))
You'll have to make sure nobody ever enters <<ANY>> for a company or
town name, and that all companies have a positive number of
employees, of course.
Michael D. Spence
Mockingbird Data Systems, Inc.
<egroup@...> wrote:
>where
> Users of my app will be able to fill in parameters that go into a
> query to search for rows. The query has fixed parameters in the
> clause: i.e.possilble
>
> where
> Co_name=:Co_Name and
> town=:town and
> Num_Employees=:Num_Employees
> etc
>
> Let's say the user is not interested in Num_Employees, is it
> to set the parameter so that clause is ignored?Make up a default value that can never occur in the field:
>
> I assume for varchar entries I can just set Col=* (or is it %?)
>
> Thanks
>
> David
>
Where ((Co_Name = :Co_Name) or (:Co_name = '<<ANY>>'))
and ((town = :town) or (:town = '<<ANY>>'))
and ((Num_employees=:Num_Employess) or (Num_employees = -1))
You'll have to make sure nobody ever enters <<ANY>> for a company or
town name, and that all companies have a positive number of
employees, of course.
Michael D. Spence
Mockingbird Data Systems, Inc.