SQL Server排序的语句
--按笔画排序
select ChannelID,ChannelName from dbo.HB_AdChannel order by ChannelName collate chinese_prc_stroke_cs_as_ks_ws
www.2cto.com
--按拼音排序
select ChannelID,ChannelName+Description from dbo.HB_AdChannel order by ChannelName+Description collate chinese_prc_cs_as_ks_ws
--sql如何让中文名字按 名字第一个字的拼音首字母排序
select isnull(b.py,upper(left(a.ChannelName+a.Description,1))) as py
,a.ChannelName+a.Description as ChannelName
from dbo.HB_AdChannel a
left outer join (
select 'A' as PY,N' ' as word, N'啊' as sword
union select 'B',N'簿',N' ' www.2cto.com
union select 'C',N' ',N'簿'
union select 'D',N' ',N' '
union select 'E',N' ',N' '
union select 'F',N' ',N' '
union select 'G',N' ',N' '
union select 'H',N' ',N' '
union select 'J',N' ',N' '
union select 'K',N' ',N' '
union select 'L',N' ',N' '
union select 'M',N' ',N' '
union select 'N',N' ',N' '
union select 'O',N' ',N' '
union select 'P',N'曝',N' '
union select 'Q',N' ',N'曝'
union select 'R',N' ',N' '
union select 'S',N' ',N' '
union select 'T',N' ',N' '
union select 'W',N' ',N' '
union select 'X',N' ',N' '
union select 'Y',N' ',N' '
union select 'Z',N' ',N' '
) b on left(ChannelName+a.Description,1) between b.sword and b.word
order by py
作者 孤独青鸟