SQL Server : how to split string to columns and rows with 2 delimiters?

Viewed 97

Input: string = '1,2,3|4,5|7,8,9,10'

Result:

----------------------------
|col1 | col2 | col3 | col4 |
----------------------------
|   1 |    2 |    3 |  null|
|   4 |    5 | null |  null|
|   7 |    8 |    9 |    10|
--------------------------- 

I know how to split to rows, but how to split to many columns.

1 Answers
Related