Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Good Morning Community,
I have many tables (source MS SQL) they have the same columns structure
Load a,b,c from Table_1;
..
Load a,b,c from Table_X;
..
Load a,b,c from Table_150;
I wana befor Loading each table ,creating new column ID that equal the number of the table TABLE_?
Résultat:
ID | a | b | c |
---|---|---|---|
1 | |||
.. | |||
150 |
hello,
i think you can use a command that reads the name of the tables from ms sql (select * from schema_tables i think)and puts them into one field;
then you read that field into a qlikview table;
then let vNoOfRows= NoOfRows('TableName');
MergedTables:
load * inline [
ID
];
then for i=0 to$( vNoOfRows)-1
let vTableName=peek('the name of the field',i,'the name of the table that contains the field');
let vTableID=replace(vTableName,'Table_','');
concatenate(MergedTables)
Load
*,
$(vTableID) as ID
From $(vTableName);
next i;
Something like that...
I hope it helps,
Andrei
Load
a,
b,
c,
'1' as ID
from Table1;
Load
a,
b,
c,
'2' as ID
from Table2;
if the table count is less do it manually. otherwise better to create a loop.
How about:
LOAD a,b,c, 'Table_1' AS ID FROM Table_1;
LOAD a,b,c, 'Table_2' AS ID FROM Table_2;
etc.
If you just want 1,2 etc. in the ID field, you can use the appropriate string function.
HTH
hello,
i think you can use a command that reads the name of the tables from ms sql (select * from schema_tables i think)and puts them into one field;
then you read that field into a qlikview table;
then let vNoOfRows= NoOfRows('TableName');
MergedTables:
load * inline [
ID
];
then for i=0 to$( vNoOfRows)-1
let vTableName=peek('the name of the field',i,'the name of the table that contains the field');
let vTableID=replace(vTableName,'Table_','');
concatenate(MergedTables)
Load
*,
$(vTableID) as ID
From $(vTableName);
next i;
Something like that...
I hope it helps,
Andrei
Thank you Surya
Thank you
thank you