Hendrik B.
Hendrik B.

Reputation: 1

HANA 'Order By' binary sort for strings

SAP HANA gives bad results when ordering by a string, as it seems to be sorted according to the Hex codes of each character? German special characters like "Ö" come after Z (should be after O) like this.

list_of_names

-Oname
-Öname
-Zname
SELECT name
FROM list_of_names
ORDER BY name

==> Oname, Zname, Öname

Is there any way to make HANA sort text the right way (like MSSQL's 'COLLATE')?

Upvotes: 0

Views: 970

Answers (2)

Florian
Florian

Reputation: 5091

There is an older answer to this in SAP‘s Q&A:

... ORDER BY name ASC with parameters('LOCALE' = 'de');

Where „de“ is an ISO language code.

Upvotes: 5

Legxis
Legxis

Reputation: 916

Characterlike components are sorted by default according to their binary representation (code page). Using ABAP, you could use the SORT function to order your table the correct way.

SORT itab AS TEXT

Upvotes: 0

Related Questions