Subject Re: [firebird-support] Comma-Separated Values
Author Helen Borrie
At 01:11 AM 6/01/2004 -0800, you wrote:
>Hi all :)

PLEASE TRIM YOUR REPLIES!!!!! This was an abominable posting - 24 hours of
other people's messages.

And make new threads, don't reply to Digests or old threads.


>We have a table in our database that stores values as a
>comma-separated
>list. This idea probably originated from the Delphi TStringList
>object.
>However, since it is bad practice in terms of database design
>principles, we
>have created another table, where each of the values in the
>comma-separated
>list will be a separate record.
>
>I now have to write a SP to copy data from the old table into
>the new one.
>In the old table, there's just one record that stores the
>comma-separated
>values. In the new table, I have to take out each value in the
>comma-separated list and insert it into a new record.
>
>Is there any way FB will support this processing, or do I need
>to do it from
>outside FB?

Both, in a way. If you know the maximum number of discrete strings each
input string would break down to, you could do it in a SP and use some
string UDFs to write a Breakapart procedure that returns a finite set of
output values, each with a different variable name. There is not enough
functionality in the internal functions to do this.

If this is a one-off thing, it might be better to do the Breakapart stuff
in a client application and pass simple parameters to an INSERT statement.

^heLen