Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

tabletuner
Contributor III

Read all database tables automatically in qlikview

Hi Forum,

I wonder whether it is possible to read all tables from a database (for example SQL or access) into qlikview automatically.

So im looking for some kind of a looping statement that determines the amount of tables and then reads all the tables into the qlikview cloud. Of course the tables have to be qualified to avoid key conflicts.

I think this solution would provide me good search opportunities with the search object.

Regards,

Tjeerd Wieberdink

Tags (3)
2 Replies
flipside
Valued Contributor II

Re: Read all database tables automatically in qlikview

Have a look at the help menu for SQLCOLUMNS, SQLTABLES & SQLTYPES. This will be what you are looking for.

flipside

tabletuner
Contributor III

Re: Read all database tables automatically in qlikview

Hi Flipside, thank you very much for the great advice!

Here is the code that worked for me:

tables_t01:

sqltables;

tables:

NoConcatenate LOAD

          *

RESIDENT tables_t01

WHERE

TABLE_TYPE='TABLE';

DROP Table tables_t01;

LET vNoOfTable = fieldvaluecount('TABLE_NAME');

qualify *;

for a=1 to $(vNoOfTable)

LET vTableName = fieldvalue('TABLE_NAME',$(a));

LET vTableType = fieldvalue('TABLE_TYPE',$(a));

          $(vTableName):

          SQL SELECT *

          FROM $(vTableName)

          ;

next

Community Browser