Subject | RE: [firebird-support] Converting FireBird Table from horizontal to vertical |
---|---|
Author | Svein Erling Tysvær |
Post date | 2010-04-22T12:05:11Z |
A string doesn't magically change into a field name. What you're doing is basically
Insert Into vinfeatvert ( vinfeatvert.VINID, vinfeatvert.FeatureID)
SELECT vinfeat.VINID, 'vinfeat.FEATUREBYTES_30'
FROM vinfeat
Where 'vinfeat.FEATUREBYTES_30' >= 1;
Insert Into delthis values ('vinfeat.FEATUREBYTES_30');
Note the quotes, 'vinfeat.FEATUREBYTES_30' is a string (i.e. CHAR(23)), not a field name.
I think you can get something similar to work if you use EXECUTE STATEMENT, but I've never really used it and don't know enough about its dangers and what precautions to take.
PS! You also have an infinitive loop since you don't change MyCounter within the loop.
HTH,
Set
-----Original Message-----
From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of Robbie
Sent: 22. april 2010 13:31
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Converting FireBird Table from horizontal to vertical
I've posted the code I've created and used to successfully move one record at a time.
For each of the records which have the multiple FEATURES columns, no value is repeated in those columns for any one record so there is no chance of duplicates in the vertical table.
Please, if you will, review my code, posted just after my original question. See what I'll have to do to make it possible for a WHILE DO loop to move each of the values, one FEATURES field at a time, to the new table.
Respectfully yours,
Allan
------------------------------------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Visit http://www.firebirdsql.org and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !
Also search the knowledgebases at http://www.ibphoenix.com
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Yahoo! Groups Links
Insert Into vinfeatvert ( vinfeatvert.VINID, vinfeatvert.FeatureID)
SELECT vinfeat.VINID, 'vinfeat.FEATUREBYTES_30'
FROM vinfeat
Where 'vinfeat.FEATUREBYTES_30' >= 1;
Insert Into delthis values ('vinfeat.FEATUREBYTES_30');
Note the quotes, 'vinfeat.FEATUREBYTES_30' is a string (i.e. CHAR(23)), not a field name.
I think you can get something similar to work if you use EXECUTE STATEMENT, but I've never really used it and don't know enough about its dangers and what precautions to take.
PS! You also have an infinitive loop since you don't change MyCounter within the loop.
HTH,
Set
-----Original Message-----
From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of Robbie
Sent: 22. april 2010 13:31
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Converting FireBird Table from horizontal to vertical
I've posted the code I've created and used to successfully move one record at a time.
For each of the records which have the multiple FEATURES columns, no value is repeated in those columns for any one record so there is no chance of duplicates in the vertical table.
Please, if you will, review my code, posted just after my original question. See what I'll have to do to make it possible for a WHILE DO loop to move each of the values, one FEATURES field at a time, to the new table.
Respectfully yours,
Allan
------------------------------------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Visit http://www.firebirdsql.org and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !
Also search the knowledgebases at http://www.ibphoenix.com
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Yahoo! Groups Links