Table Normalization (Parse comma separated fields into individual records)

前端 未结 4 682
北荒
北荒 2021-01-13 03:31

I have a table like this:

Device

DeviceId   Parts

1          Part1, Part2, Part3
2          Part2, Part3, Part4
3          Part1
         


        
4条回答
  •  北海茫月
    2021-01-13 04:21

    Have a look at using fn_Split to create a table variable from the comma separated values. You can then use this to drive your insert.

    EDIT: Actually, I think you may still need a cursor. Leaving this answer incase fn_Split helps.

提交回复
热议问题