Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join us at the Cloud Data and Analytics Tour! REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
amluna
Contributor
Contributor

LOAD SQL COMMANDS LIST, RUN SQL COMMANDS LIST AND SAVE ALL THE RESULTS IN THE SAME TABLE OR FILE

Hi All.

PLEASE CAN YOU HELP WITH THIS? THANKS IN ADVANCE.

I NEED LOAD SQL COMMANDS LIST FROM EXCEL FILE, RUN SQL COMMANDS LIST AND SAVE ALL THE RESULTS IN THE SAME TABLE OR FILE

MY EXCEL SOURCE FILE IS AS:

EXCEL FILE SOURCE
TABLE_CATALOGTABLE_SCHEMATABLENAMESQL COMMAND
DATABASE_ADBOTABLE_ASELECT COUNT (*) FROM DATABASE_A.DBO.TABLE_A
DATABASE_ADBOTABLE_BSELECT COUNT (*) FROM DATABASE_A.DBO.TABLE_B
DATABASE_ADBOTABLE_CSELECT COUNT (*) FROM DATABASE_A.DBO.TABLE_C

 

MY DESTINATION QVD OR CSV FILE  FOR TAGRGET RESULTS IN ONE UNIQE TABLE IS:

 

TAGRGET RESULTS IN ONE UNIQE TABLE
TABLE_CATALOGTABLE_SCHEMATABLENAMECOUNT_OF_ROWS
DATABASE_ADBOTABLE_A100
DATABASE_ADBOTABLE_B200
DATABASE_ADBOTABLE_C300

 

Load_Count_Origin_Queries:

LOAD

Id_TableQueries,
TableAutSelect_TableQueries,
ActQuery_TableQueries,
QueryName_TableQueries,
QueryDesc_TableQueries,
Server_TableQueries,
Table_Catalog_TableQueries,
Table_Name_TableQueries,
Table_Schema_TableQueries,
QueryPt1_TableQueries,
QueryPt2_TableQueries,
Query_TableQueries,
now() as DateTime_TableQueries

//DEFINE ROUTE OF EXCEL SOURCE FILE & SPECIFIC SHEET
FROM $(Var_Table_List_Folder)\Table_List.xlsx (ooxml, embedded labels, table is OrgTableQueries);


//STORE LOADED DATA INTO TEMPORARY TABLE & QVD FILE
STORE Load_Count_Origin_Queries into $(Var_Qvd_Files_Folder)\Load_Count_Origin_Queries.qvd (qvd);
//STORE LOADED DATA INTO TEMPORARY TABLE & CSV FILE
STORE Load_Count_Origin_Queries into $(Var_Qvd_Files_Folder)\Load_Count_Origin_Queries.csv (txt);


MyTab:

LOAD now() as DateTimeSQLCmd_Qry1_T,

QueryName_TableQueries, Query_TableQueries

RESIDENT Load_Count_Origin_Queries where ActQuery_TableQueries='Yes';

FOR i = 0 to NoOfRows('MyTab')-1

LET QueryName_TableQueries = peek('QueryName_TableQueries', $(i), 'MyTab');

LET Query_TableQueries= peek('Query_TableQueries', $(i), 'MyTab');

// Put the SQL here or call it as A SUB

Query_TableQueries:

SQL $(Query_TableQueries);

STORE MyTab into $(Var_Qvd_Files_Folder)\MyTabIN.qvd (qvd);
STORE MyTab into $(Var_Qvd_Files_Folder)\MyTabIN.csv (txt);


NEXT i

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Labels (1)
0 Replies