have a table tb, follows: id value 1 aa,bb 2 aaa,bbb,ccc Split the value column by id, and the results are as follows: id value 1 aa 1 bb 2 aaa 2 bbb 2 ccc */ create table tb(id int,value varchar(30)) insert into tb values(1,'aa,bb') insert into tb values(2,'aaa,bbb,ccc') go thanks! |
I'm not sure I understand your question but I guess you are asking for select tb.id, sp.row_value from tb cross apply sa_split_list(tb.value, ',') sp order by 1, 2 |
What have you tried so far?
Oops, I overlooked that important comment:(