Subject Converting FireBird table from horizontal format to vertical
Author Lars Mith
I have a table which has over 32 columns in it.
The first column is a unique identifier.
Each column there after starts with FEATURE_ and follow the pattern where
after the _ is either a single digit ( 1..9 ) or double digits (10..30) such
that they look like :

In table #2, the 1st field is an ID field, into which I wish to insert the
ID's from the 1st table.
What I need to do after that is to check each column at a time of the 1st
column and, if they have a value greater than 0, I want that data to be
inserted into column #2 in the 2nd table.

Next, I need to follow the same steps with the second column, then the
third, etc. till I've inserted into the 2nd table all of the ID's and the
values > 0 from each of the 30 feature columns.

I've created a query to do this but the query requires me to run it once for
the 1st FEATURES column then edit the query, change it to FEATURES_2 and run
it again, then edit & change it to FEATURES_3 and run it again, till I've
run it once for each of the 30 FEATURES columns.

Now what I want to do is to create a procedure which will automate this
process for me and I've been struggling with just how to do it with a WHILE
DO loop.

Any / All help with this will be greatly appreciated by this FireBird

Respectfully yours,
P.S. I tried earlier to post this message but I haven't found it on the list
of postings. If it does appear twice, please forgive.

[Non-text portions of this message have been removed]