Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi!
Guys, can anyone tellme how can I add values to an existing field in the script?
For example, I have a field like:
Field1:
A
B
C
D
I want to add values E,F,G.
The desired result is :
Field 1:
A
B
C
D
E
F
G
Hia Diana,
It depends on the way you load your data.
This one will work:
LOAD * INLINE [
Letterx
A
B
C
D
];
LOAD * INLINE [
Letterx
E
F
G
];
But you probably have to use the concatenate load and make sure the new data has the same structure/fields as
the original structure.
How do load your data? Is it an ODBC connection? Excel? Txt/CSV?
Share a part of your data and we'll tell you how to..
Grtz Fred
It's CSV. The first table has 6 columns and the second one has only 2 columns that has the same names as the fields in the first tables.
I want to join these two tables as I've written above.
Can I use "concatenate" if the number of fields of these tables isnt the same?
Or do i have to use 'Join'?
Hi Diana,
This looks like a 'join'.
Share some example records of your first and of your second table.
Grtz Fred
You can use an "auto concatenate" or a "forced concatenation".
To enable the auto concatenation you will have to add the extra columns on the second CSV by doing a preceding load where you populate nulls or some other appropriate value in the missing columns.
To do a forced concatenation you will have to write CONCATENATE in front of you LOAD statement and then the missing columns will automatically get nulls for the second table.
T1:
LOAD
Field1,
Field2,
Field3,
Field4,
Field5,
Field6
FROM
[my-file1.csv] (txt, codepage is 1252, embedded labels, delimiter is ';', msq);
T2:
CONCATENATE LOAD
F1 AS Field1,
F2 AS Field2
FROM
[my-file2.csv] (txt, codepage is 1252, embedded labels, delimiter is ';', msq);
I feel that it is a concatenate from what you posted in your example above. You can definitely concatenate if the two data sources don't have the same number of columns (those columns which don't match up will remain null).
HTH
Best,
Sunny