How do I sort string alphabetically

前端 未结 4 1814
半阙折子戏
半阙折子戏 2020-12-07 02:33

I am new to SQL Server as well as to Stack overflow. Please excuse for my mistakes.

Is it possible to sort a value in a column aphabetically? Here is my table

<
4条回答
  •  -上瘾入骨i
    2020-12-07 02:59

    Not mssql, but in Presto I found this way. Maybe someone can convert it, or find a better way to split string to array, sort and join back:

    SELECT ARRAY_JOIN(ARRAY_SORT(REGEXP_EXTRACT_ALL('aaffed', '.')), '') --> 'aadeff'
    

提交回复
热议问题