版权声明：本文为博主原创文章，遵循 CC 4.0 by-sa 版权协议，转载请附上原文出处链接和本声明。
I have a simple demo, I have create a table which contains 3 rows and they all have a column named"CNAME" to display their Chinese name. And for column ENAME, it displays their Chines name in pinyin.
DROP TABLE TEST_SORT; CREATE TABLE TEST_SORT ( SID INTEGER, CNAME NVARCHAR(100), ENAME NVARCHAR(20)); INSERT INTO TEST_SORT Values (1, '山东', 'ShanDong'); INSERT INTO TEST_SORT Values (2, '华为', 'Huawei'); INSERT INTO TEST_SORT Values (3, '爱活力', 'Aihuoli');
You could open sql trace with result when you executing the sort statement:
select * from TEST_SORT ORDER BY CNAME desc;
The result in sql trace shows that the Chinese name will be transfer to Hexadecimal character when they are stored in the system and the compare are in fact in these Hexadecimal character:
cursor_140298224832512_c136.execute(’’’ select * from TEST_SORT ORDER BY CNAME desc ‘’’)
Therefore, 爱活力 will be bigger than 山东 and 华为.
If you want to sort the Chinese character as you expected, I think the most convenient way is to add a column that display the Chinese name in pinyin and sort in that column.