Sample Header Ad - 728x90

Split comma separated entries to rows

5 votes
3 answers
24940 views
I have a table like this: | ID | OtherID | Data +--------+-----------+--------------------------- | 5059 | 73831 | 5103,5107 | 5059 | 73941 | 5103,5104,5107 | 5059 | 73974 | 5103,5106,5107,5108 And the result should return individual rows, like this: | ID | OtherID | Data +--------+-----------+-------------------------- | 5059 | 73831 | 5103 | 5059 | 73831 | 5107 | 5059 | 73941 | 5103 | 5059 | 73941 | 5104 | 5059 | 73941 | 5107 | 5059 | 73974 | 5103 | 5059 | 73974 | 5106 | 5059 | 73974 | 5107 | 5059 | 73974 | 5108 Basically, I need to split my data at the comma into individual rows. The result will be stored in a temporary table (Like: ID, OtherID, NewID). My version of DB2 is 9.7
Asked by Yuri Marques (51 rep)
Aug 5, 2014, 05:00 PM
Last activity: Apr 15, 2020, 07:38 PM