Board index » delphi » Master-Detail with LIKE % operator

Master-Detail with LIKE % operator


2004-10-18 07:42:36 PM
delphi103
I have a problem with a master-detail relationship. I'd like to link the
detail to the master with an SQL statement that uses a LIKE % operator. How
do I specify the SQL property of my TIBQuery component?
Statements like
SELECT * FROM TBL_DETAIL WHERE KEY LIKE :PARAM%
or
SELECT * FROM TBL_DETAIL WHERE KEY LIKE ':PARAM%'
don't work.
Any ideas?
 
 

Re:Master-Detail with LIKE % operator

you must include the wildcard character in the parameter value.
--
Bill (TeamB)
TeamB cannot answer questions received via email
 

Re:Master-Detail with LIKE % operator

How can I do this? The Parameter is derived from the master table and is
therefore fixed.
"Bill Todd" <XXXX@XXXXX.COM>schrieb im Newsbeitrag
Quote
you must include the wildcard character in the parameter value.

--
Bill (TeamB)
TeamB cannot answer questions received via email
 

Re:Master-Detail with LIKE % operator

You cannot. The best solution is to normalize your database designe so
you do not have to link on part of a field. If you have to use LIKE and
a wildcard for the link then you must have something in addition to the
foreign key value stored in that field. Store the foreign key in a
field by itself and you will not have to use LIKE.
--
Bill (TeamB)
TeamB cannot answer questions received via email
 

Re:Master-Detail with LIKE % operator

Quote
I have a problem with a master-detail relationship. I'd like to link
the
detail to the master with an SQL statement that uses a LIKE % operator.
How
do I specify the SQL property of my TIBQuery component?

Statements like

SELECT * FROM TBL_DETAIL WHERE KEY LIKE :PARAM%

or

SELECT * FROM TBL_DETAIL WHERE KEY LIKE ':PARAM%'

don't work.

Any ideas?
SELECT * FROM TBL_DETAIL WHERE KEY LIKE :PARAM||'%'
SELECT * FROM TBL_DETAIL WHERE KEY starting with :PARAM
Good Luck