Subject RE: [IBO] sort order in firebird
Author Svein Erling Tysvær
>hi all
>
>i have a problem when sorting tib_query
>example:
>
>data in column :
>AA
>Aa
>aA
>AA
>BB
>
>ib_connection.charset=utf8,
>result for above table, like below:
>AA
>Aa
>BB
>aA
>aa
>
>and should order like this:
>aa
>aA
>Aa
>AA
>BB
>
>the question how to fix sort order with lowercase priority ?

That is actually an unusual requirement (the usual way to deal with this is to either use a case insensitive or case sensitive collation, not a "partially case sensitive" collation) and I doubt Firebird has any inbuilt support for it. I guess the correct way to solve your problem, would be to create your own collation - though I've no idea how to do that and that is more appropriate to ask at firebird-support than here (Stefan Heymann knows a lot about the subject, see www.destructor.de).

IBO do support the concept of an upper case equivalent column. So a pragmatic solution might be to have a BI/BU-trigger that sets such a column to the following values (adding u to each uppercase letter and l to each lowercase, you figure out the trigger yourself):

MyColumn MyUpperCaseEquivalent
AA AuAu
Aa AuAl
aA AlAu
aa AlAl
BB BuBu

HTH,
Set