T-SQL Split Word into characters

前端 未结 5 1197
太阳男子
太阳男子 2020-11-28 12:19

I have searched everywhere and I cannot find this implementation anywhere.

Let\'s say I have the word: QWERTY

I want to obtain this table:

5条回答
  •  爱一瞬间的悲伤
    2020-11-28 12:57

    Do it like this:

    select substring(a.b, v.number+1, 1) 
    from (select 'QWERTY AnotherWord' b) a
    join master..spt_values v on v.number < len(a.b)
    where v.type = 'P'
    

提交回复
热议问题