Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
HI All,
I have a script like below,
Data:
LOAD [Col 1],
[Col 2],
[Col 3],
[Col 4],
[Col 5],
[Col 6],
[Col 7],
'Data 001' as Flag
FROM
Concatenate
LOAD [Col 1],
[Col 2],
[Col 3],
[Col 4],
[Col 5],
[Col 6],
[Col 7],
'Data 002' as Flag
FROM
Concatenate
LOAD [Col 1],
[Col 2],
[Col 3],
[Col 4],
[Col 5],
[Col 6],
[Col 7],
'Data 003' as Flag
FROM
STORE Data into FinalData.Qvd(Qvd);
My requireemen is to automate my loading is,
In my folder files are having like Data 001,Data 002,Data 003 and so on....
Now i am loading manually and creating flag with File name and storing into single file.
If i have 100 files in my folder i can't load them and create flag with file manually.
Can any one tell me how to write loops for this....?
THANKQ IN ADV
Hi Subbareddy,
Try to use Load *:
Data:
LOAD...
..
..
From
D:\Live\FolderName\*.qvd(qvd);
STORE Data into FinalData.Qvd(Qvd);
Thanks,
Arvind Patil
Data:
LOAD [Col 1],
[Col 2],
[Col 3],
[Col 4],
[Col 5],
[Col 6],
[Col 7],
Left(FileName(),8) as Flag
FROM
(ooxml, embedded labels, table is Sheet1);
Or
Data:
LOAD [Col 1],
[Col 2],
[Col 3],
[Col 4],
[Col 5],
[Col 6],
[Col 7],
Left(FileName(),8) as Flag
FROM
hi
it load all the files but what about my flag then?
have a look at the attachments...
LOAD
*,
FileName() as TYP
FROM
[Wert***.xlsx]
(ooxml, table is Tabelle1);
Hi,
Try this ways for multiple excel loads and use FileBaseName function to create the table flag and use * for loading multiple excel files.
Data:
LOAD *
FileBaseName() as TableFlag
FROM
[C:\Users\Home\Downloads\Data*.xlsx]
(ooxml, embedded labels, table is Sheet1);
STORE Data into FinalData.Qvd(Qvd);
Regards
Anand
Hi,
Instead of FileName(),
you can use filebasename() then you can avoid Left().
Regards,
Prashant
HI, This working fine,
Can i apply same in my Data Base level (SQL DB)?
I see you should use * or ??? instead of ***
Hi Subbareddy,
Data:
LOAD...
..
..
From
D:\Live\FolderName\Data*.qvd(qvd);
STORE Data into FinalData.Qvd(Qvd);
Thanks,
Arvind Patil