on 2019 Apr 16 8:51 AM
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
71 | |
11 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.