The forum will be down for scheduled maintenance on Saturday, March 4 beginning at 10am EST. Actual downtime is unknown but may be several hours.

We are using sql anywhere 12

We often get data provided to us for conversion to the database where they have text fields which contain comma separated values. Other than writing a application program to parse these out, is there any SQL that can parse a comma separated value into multiple rows a another table with reference to the source key.

If not in SA 12 - is there functionality in SA16?

asked 15 Oct '13, 14:14

Glenn%20Barber's gravatar image

Glenn Barber
1.1k234051
accept rate: 0%


Have a look at sa_split_list. The second parameter allows you to specify the delimiter - the default is a comma.

Example:

select * from sa_split_list( 'one,two,three' );

gives this result set:

line_num row_value
       1 one
       2 two
       3 three

sa_split_list has existed since at least v8 version 10.

permanent link

answered 15 Oct '13, 14:28

Mark%20Culp's gravatar image

Mark Culp
22.5k9129264
accept rate: 40%

edited 15 Oct '13, 15:24

1

AFAIK, sa_split_list() has been officially added in v10.0.0:)

(15 Oct '13, 15:10) Volker Barth
Replies hidden
2

Hmmm, looks like you are correct - see the What's New in version 10.0.0. I guess I was using it for many years before it became part of the product ;-)

(15 Oct '13, 15:22) Mark Culp
Your answer
toggle preview

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×2

question asked: 15 Oct '13, 14:14

question was seen: 409 times

last updated: 15 Oct '13, 15:24