How Do I Split a Delimited String in SQL Server Without Creating a Function?

前端 未结 11 1719
慢半拍i
慢半拍i 2020-11-29 08:28

I\'m working with a SQL Server database. I have a column which contains a delimited list, and I need to write a query which splits the values of the list into rows. From bro

11条回答
  •  南方客
    南方客 (楼主)
    2020-11-29 09:22

    For sql Server >= 2016 you can use string_split as below:

    SELECT * FROM string_split('Hello John Smith', ' ')
    

    Output

    +-------+
    | value |
    +-------+
    | Hello |
    | John  |
    | Smith |
    +-------+
    

提交回复
热议问题