Article View: borland.public.intrabuilder.data.sql
Article #45Re: SQL case sensitive??
From: Steve Koterski
Date: Thu, 29 Jan 1998 00:00
Date: Thu, 29 Jan 1998 00:00
41 lines
2271 bytes
2271 bytes
On Thu, 29 Jan 1998 21:27:03 GMT, Niels@lx.student.wau.nl (N. van Dijk)
wrote:
>I have a slight problem getting my query workt out all right:
>I need to locate the fields in the database according to a keyword
>provided by the user. Seem pretty simple I'd say. I first tried
>embedding the keyword into the sql property of the query, something
>like:
>query.sql = "SELECT * FROM Prijsl.dbf WHERE (OMSCHRIJVI LIKE
>'%pulse%')";
>although this seems to work fine, all the fields with "Pulse" don't
>get selected.
>
>To bad, but nothing lost: Just use applyLocate(). However, applylocate
>doesn't seem to work with the LIKE '%pulse%', because IB constantly
>get back with a : "Unnallowed fhrase/keyword in statment: LIKE
>'%pulse%'
>
>Is there anyone who could help me outon this one? I always thought sql
>was case INsensative, and I also thouh=ght applyLocat could use LIKE,
>so what going wrong?
The SQL-92 specification defines the assertion of the LIKE predicate to be
case-sensitive. This is the correct behavior.
To compose a query with a case-insensitive WHERE clause LIKE predicate
comparison, simply apply the SQL function UPPER to both the filter column
and the filtering value (literal, parameter, or subquery result). By
putting both in the same casing, you end up with a case-insensitive LIKE
predicate comparison.
SELECT *
FROM "Prijsl.dbf"
WHERE (UPPER(OMSCHRIJVI) LIKE UPPER("%pulse%"))
**************************************************************************
Steve Koterski
Borland International, Inc.
http://www.borland.com/delphi
(Remove the "SPICEDHAM2" from the address. Death to spam-bots!)
Technical Details
Message-ID:
<34d0f920.19869718@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<34d0f247.45133956@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 101d9a,7c235f5c1fa6801 X-Google-Attributes: gid101d9a,public From: koterski@SPICEDHAM2borland.com (Steve Koterski) Subject: Re: SQL case sensitive?? Date: 1998/01/29 Message-ID: <34d0f920.19869718@forums.borland.com> X-Deja-AN: 320381853 Content-Transfer-Encoding: 7bit References: <34d0f247.45133956@forums.borland.com> Content-Type: text/plain; charset=us-ascii Organization: Borland International, Technical Publications Mime-Version: 1.0 Reply-To: koterski@SPICEDHAM2borland.com Newsgroups: borland.public.intrabuilder.data.sql