SQL 字符串排序 (字符串爲數字、字母、漢字)

排序前的結果

1,

11,

12,

2,

21,

22


--sql 處理 使用isnumeric() 函數 和 numeric() 函數

select * from work_order order by case when isnumeric(OR_No_Txt)=1 then 0 else 1 end , 

case when isnumeric(OR_No_Txt)=1 then cast(OR_No_Txt as numeric(28,8))  end,OR_No_Txt


排序後的結果

1,

2,

11,

12,

21,

22

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章