Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all
I wish to load only the fields identified with flag = Y from an Excel sheet which determines which fields should be loaded from a database table.
Excel Doc Example
FieldName Flag
CustomerID Y
ProductID Y
ProductCategory N
ProductSubCat N
Now I want to load only the fields identified with Flag = Y from database Table...
I have tried something like this
//=================================================
temp:
Load FieldName as XXX
From
Excel
where Flag = 'Y'
Table:
Load
fieldname
from
databasetable
where exists ( XXX , fieldname );
DROP Table temp;
//=================================================
The result I want is that only the two fields from the database table (CustomerID and ProductID)
are loaded into the table.
Any ideas?
Thanks
How about:
temp:
LOAD concat(FieldName,',') as FieldList
From Excel
where Flag = 'Y'
;
LET vFieldList=peek('FieldList');
DROP TABLE temp;
mytable:
LOAD
$(vFieldList)
FROM database.table
;
-Rob
How about:
temp:
LOAD concat(FieldName,',') as FieldList
From Excel
where Flag = 'Y'
;
LET vFieldList=peek('FieldList');
DROP TABLE temp;
mytable:
LOAD
$(vFieldList)
FROM database.table
;
-Rob
Thanks Rob
Works a treat...
Appreciate you taking the time to provide solution
Cheers
Dave