Board index » delphi » Ordering with Sql Statements NOT Case Sensitive

Ordering with Sql Statements NOT Case Sensitive

I have a Tquery where I enter a Sql statement with an order by clause which
operates on a string field. The problem is that the order by statement sorts
case-sensitive. I need to sort the query Case-Insensitive. Can anyone help
me out?

Nadav

 

Re:Ordering with Sql Statements NOT Case Sensitive


ORDER BY  UPPER( MyStringField )

i have found in the past that using UPPER can slow queries down.  you'll find
out... :)

Quote
Nadav Golombick wrote:
> I have a Tquery where I enter a Sql statement with an order by clause which
> operates on a string field. The problem is that the order by statement sorts
> case-sensitive. I need to sort the query Case-Insensitive. Can anyone help
> me out?

> Nadav

Re:Ordering with Sql Statements NOT Case Sensitive


if you use functions in an SQL statement then (at least in Oracle)
the indexes are not used and full table scans are performed.

Quote
David Beardwood wrote:

> ORDER BY  UPPER( MyStringField )

> i have found in the past that using UPPER can slow queries down.  you'll find
> out... :)

> Nadav Golombick wrote:

> > I have a Tquery where I enter a Sql statement with an order by clause which
> > operates on a string field. The problem is that the order by statement sorts
> > case-sensitive. I need to sort the query Case-Insensitive. Can anyone help
> > me out?

> > Nadav

--
Stewart
ICQ: 5308166
http://freespace.{*word*269}.net/s.hector/index.html

Re:Ordering with Sql Statements NOT Case Sensitive


oh.

i guess that makes sense.  thanks for the tip.
dave

Quote
> if you use functions in an SQL statement then (at least in Oracle)
> the indexes are not used and full table scans are performed.

> > ORDER BY  UPPER( MyStringField )

Re:Ordering with Sql Statements NOT Case Sensitive


Ordering CAN be case sensetive, depends on the database - Oracle
orders are case sensitive for example:

anthony
ben
emma
Anthony
Ben
Emma

Quote
David Beardwood wrote:

> oh.

> i guess that makes sense.  thanks for the tip.
> dave

> > if you use functions in an SQL statement then (at least in Oracle)
> > the indexes are not used and full table scans are performed.

> > > ORDER BY  UPPER( MyStringField )

--
Stewart
ICQ: 5308166
http://freespace.{*word*269}.net/s.hector/index.html

Other Threads