数据库汉字按拼音排序

数据库汉字按拼音排序
2009-06-17 12:19
SQLServer:

SELECT * FROM dept ORDER BY name COLLATE Chinese_PRC_CS_AS_KS_WS

Oracle:

1. //按照笔划排序
select * from dept order by nlssort(name,'NLS_SORT=SCHINESE_STROKE_M');

2. //按照部首排序
select * from dept order by nlssort(name,'NLS_SORT=SCHINESE_RADICAL_M');

3. //按照拼音排序,此为系统的默认排序方式
select * from dept order by nlssort(name,'NLS_SORT=SCHINESE_PINYIN_M');

MySQL:

如汉字姓名字段,希望按汉字拼音排序,则设置该字段的
column charset = gbk, column collate = gbk_chinese_ci
SELECT * FROM dept ORDER BY name;
这样就能够正常排序了!

 

 

文章来自:http://hi.baidu.com/alongchina/blog/item/567f4fb2d1af49aed9335aa0.html 

你可能感兴趣的:(html,oracle,mysql,Blog)