Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello all,
I am loading data frequently from an existing table (resident) to add it slightly modified to the same table.
Typically I want to change exactly 1 field.
Example:
TabA:
LOAD
a,
b,
c
from SQL ....;
concatenate (TabA)
LOAD
a,
'Copy' as b,
c
resident TabA;
For a small number of fields this is fine, but for lots of fields, the script gets difficult to read.
There must be a smarter way .... ? (I really just want to change 1 field out of e.g. 30.)
This
LOAD
*,
'Copy' as b
resident TabA;
does not work, as field b would be twice in the load statement.
Any idea?
Thank you,
Thilo
TabA:
LOAD
a,
b,
c
from SQL ....;
TabTemp:
LOAD
*
resident TabA;
DROP FIELD b FROM TabTemp;
CONCATENATE (TabA)
LOAD
*,
'Copy' as b
resident TabTemp;
DROP TABLE TabTemp;
This should work but isn't good for the performance of your loadscript!
Thilo wrote:
LOAD
*,
'Copy' as b
resident TabA;
does not work, as field b would be twice in the load statement.
Try this:
TabA:
LOAD
a,
b,
c
from SQL ....;
DROP FIELD b;
LOAD
*,
'Copy' as b
resident TabA;
Hello Sander,
Not yet ... as I want to keep the contents of b ... both from the SQL and the new load.
Simple use case:
TabA: Load 1 as Version, Value1, Value2 from SQL
concat. TabA: Load 2 as Version, Value1, Value2 resident TabA
(i.e. I copy the value data to a new version.)
Typically there is a lot of transformation code between the two statements, i.e. it is not as simple as reloading the SQL 😉
Thank you,
Thilo
TabA:
LOAD
a,
b,
c
from SQL ....;
TabTemp:
LOAD
*
resident TabA;
DROP FIELD b FROM TabTemp;
CONCATENATE (TabA)
LOAD
*,
'Copy' as b
resident TabTemp;
DROP TABLE TabTemp;
This should work but isn't good for the performance of your loadscript!
yep - this would work ... and you're right, the performance will suffer.
Well, there is always a trade-off ... 😉
Thank you,
Thilo