0

In my case I have table with data are like that:

error_id|role_id|
--------+-------+
       6|1;4;5  |
       7|3;2    |

How can i change this table to this:

error_id|role_id|
--------+-------+
       6|1      |
       6|4      |
       6|5      |
       7|3      |
       7|2      |

I will be very glad if you have any idea

pearowaty
  • 1
  • 1

1 Answers1

3

Small task using a CROSS APPLY and string_split()

Select A.error_id
      ,role_id = B.Value
  From YourTable A
  Cross Apply string_split(role_id,';') B
John Cappelletti
  • 79,615
  • 7
  • 44
  • 66