2 Replies Latest reply: Oct 19, 2016 10:30 AM by Noha Salem RSS

    Loading tables



      now I have a file on the qlik sense desktop that I need to load all its tables in to the app so I can preview it and work on it.

      the problem is that it has almost a 100 table with tons of rows so I am looking for a SQL Load statement to select the top 100 rows from each table at once.


      Currently I am using this :


      Select Top 100 *

      From XYZ;


      but that will take for ever plus typing mistakes can occur. so is there a one statement I can use.


      note : that there is no qvd file the only source currently present is :




      thanks in advance. hope somebody can help soon.



        • Re: Loading tables
          Gysbert Wassenaar

          No, there's no one statement that you can use. You'll have to use an odbc connection and the odbc command SQLTABLES to create a table with a list of all the tables. Then you have to iterate through that new table and for each record in that table get the name of the source table you want to load from your source database and load the first 100 records.


          Something like this maybe:


          LIB CONNECT TO 'AG1';



          For i = 1 to NoOfRows('TableList')

               LET vTableName = Trim(FieldValue('TABLE_NAME',$(i)));


               FIRST 100

               SQL SELECT * FROM $(vTableName);


          DROP TABLE TableList;