Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

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')



asked 16 Apr '19, 07:51

mfkpie8's gravatar image

accept rate: 12%


What have you tried so far?

(16 Apr '19, 07:58) Justin Willey
Replies hidden

Oops, I overlooked that important comment:(

(16 Apr '19, 08:09) Volker Barth

I'm not sure I understand your question but I guess you are asking for

select, sp.row_value
from tb cross apply sa_split_list(tb.value, ',') sp
order by 1, 2
permanent link

answered 16 Apr '19, 08:07

Volker%20Barth's gravatar image

Volker Barth
accept rate: 34%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 16 Apr '19, 07:51

question was seen: 1,024 times

last updated: 16 Apr '19, 08:09