As there is no builtin command in FPW2.6 that allows additions of columns to a table programmatically, I decided to write something to do the job... (call it a training exercise)
I'm doing a COPY STRUCTURE EXTENDED TO... to a SYS(3) file.
I'm then appending records for the new columns into that table.
I then CREATE ... FROM ... into another SYS(3) file.
Which gives me:
My original table.
A Uniquely Named new table that describes a structure.
A Uniquely Named new table of that structure.
So, now I want to fill the new table with the data from the old table, and I've been given two conflicting stories of how to do this. Please bear in mind that I want to also transfer deleted records to the new table (but marked as deleted).
I was told first that all I need to do is:
SET DELETED OFF
APPEND FROM oldtable
SET DELETED ON
...but later told that this would NOT transfer deleted records...
So I was then given something along the lines of:
SET DELETED OFF
SELECT oldtable
SCAN
SCATTER BLANK MEMVAR
SELECT newtable
APPEND BLANK
GATHER MEMVAR
IF DELETED(oldtable)
DELETE
ENDIF
SELECT oldtable
ENDSCAN
SET DELETED ON
What's the story, and is there a 'cleaner' way to do it if the latter is the 'solution' ???
I'm doing a COPY STRUCTURE EXTENDED TO... to a SYS(3) file.
I'm then appending records for the new columns into that table.
I then CREATE ... FROM ... into another SYS(3) file.
Which gives me:
My original table.
A Uniquely Named new table that describes a structure.
A Uniquely Named new table of that structure.
So, now I want to fill the new table with the data from the old table, and I've been given two conflicting stories of how to do this. Please bear in mind that I want to also transfer deleted records to the new table (but marked as deleted).
I was told first that all I need to do is:
SET DELETED OFF
APPEND FROM oldtable
SET DELETED ON
...but later told that this would NOT transfer deleted records...
So I was then given something along the lines of:
SET DELETED OFF
SELECT oldtable
SCAN
SCATTER BLANK MEMVAR
SELECT newtable
APPEND BLANK
GATHER MEMVAR
IF DELETED(oldtable)
DELETE
ENDIF
SELECT oldtable
ENDSCAN
SET DELETED ON
What's the story, and is there a 'cleaner' way to do it if the latter is the 'solution' ???