Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear all,
I want to create a new field in the load-statement which value should be equal to the name of the table. This is the table where the LOAD-statement refers to.
Regards,
Maurice
whr is ur table?
may be,
tab3:
Load * Inline [
dim1,dim2
-4,0
-2,0.2
0,0.4
2,0.6
4,0.8
];
Tba2:
NoConcatenate load
dim1,
dim2,
'Tba2' as Tba2
Resident tab3;
drop table tab3
You can use TableName() function like this:
Table:
LOAD * INLINE [
Dim, Value
A, 10
B, 20
C, 10
];
Join(Table)
LOAD *,
TableName(0) as TableName
Resident Table;
Output:
My Load statement is as follows:
LOAD Date,
Value1,
Value2;
SQL SELECT *
FROM `OS1`;
Now I want to create a new field (Tablename) which always shows the value OS1
Try this as buzzy996 mentioned
OS1:
LOAD Date,
Value1,
Value2,
'OS1' as Tablename;
SQL SELECT *
FROM `OS1`;
or use this for what I mentioned:
OS1:
LOAD Date,
Value1,
Value2;
SQL SELECT *
FROM `OS1`;
Join(OS1)
LOAD *,
TableName(0) as Tablename // 0 within parenthesis will depend on which table number it is in your load where first table = 0, second = 1, third = 2 and so on...
Resident OS1;
HTH
Best,
Sunny
Thank you Sunny, this works.
But actually I would like to use the tablename of the source database.
Like this:
Substation:
LOAD Date,
Value1,
Value2,
'OS1' as Tablename;
SQL SELECT *
FROM `OS1`;
I am not sure if I know how to do that. Might be somebody else knows how to do it
Best,
Sunny
Thank you, with your answers I can continue anyway.
Best,
Maurice
That's true , but I still hope that you find a better solution