Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
chinnuchinni
Creator III
Creator III

how to load multiple tables from Sql server and store it into Individual QVD

Hi All,

Can any one help me with sample script to load multiple tables from DB to Qv and the store it into qvds.

 

Say example , I have tables like,

abc.abc.abc_2017, 

abc.abc.abc_2018, 

abc.abc.abc_2019.......

Need to load  multiple tables  and store it into qvds

Regards

PC

 

 

 

 

Labels (2)
4 Replies
Vengatesh
Partner - Creator
Partner - Creator

Best way to do this is, Create an excel file with all the table names. and use FOR loop in QV script.

TABLE_LIST:
LOAD
TableName
FROM [..\Support\TableList.xlsx]
(ooxml, embedded labels, table is [Table List]);

OLEDB CONNECT TO [...];

FOR EACH file in FieldValueList('TableName')
TABLE_NAME:
SQL SELECT * FROM Abc.dbo.$(file);

STORE TABLE_NAME INTO [..\Qvd\$(file).QVD];
DROP TABLE TABLE_NAME;

NEXT file

DROP TABLE TABLE_LIST;

You Know What To Do.
chinnuchinni
Creator III
Creator III
Author

thank you for quick responce. but is it possible without creating a table. bcz for next year we need to add manually another table to that table.

I need dynamic script without creating table.

Regards

PC

anushree1
Specialist II
Specialist II

use table name in the from statement as abc_*

Eg:Table_Name

load Fieldname1, fieldname2,.....;

select * from abc_*;

Here all the table names starting with abc will get loaded, but the post suggesting use of excel would probably be a better option to maintain consistency and keep in track of what files you would exactly like to load

 

 

 

chinnuchinni
Creator III
Creator III
Author

thank you for your response. but it will not suitable for me.