<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to load all tables from sql DB? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-load-all-tables-from-sql-DB/m-p/450902#M1160043</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is not good practice to load all tables in a loop, because you don't actually require all the tables for report, also all columns in the tables are not required.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also in For loop the execution will be very slow.&amp;nbsp; In my view writing and loading the data manually from each table is best option.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 20 Nov 2012 13:11:43 GMT</pubDate>
    <dc:creator>jagan</dc:creator>
    <dc:date>2012-11-20T13:11:43Z</dc:date>
    <item>
      <title>How to load all tables from sql DB?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-load-all-tables-from-sql-DB/m-p/450901#M1160042</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;How can I make QV to load all tables from a SQL DB? &lt;/P&gt;&lt;P&gt;Something like &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG&gt;Load *;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG&gt;SQL SELECT *&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;FROM KQ0.*&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;Somekind of loop function?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;Edit:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;I found and tryd this but did not work. All I get is the TABLE_NAME table. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Sub LoadTableNames&lt;/P&gt;&lt;P&gt;SQLTableList:&lt;/P&gt;&lt;P&gt;LOAD "TABLE_NAME" as&amp;nbsp; TableNames;&lt;/P&gt;&lt;P&gt;SQL SELECT "TABLE_NAME"FROM KQ0."INFORMATION_SCHEMA".COLUMNS;&lt;/P&gt;&lt;P&gt;End Sub;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Call LoadTableNames;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let vTableCount = NoOfRows(‘SQLTableList’);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sub LoadTableData&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For i = 0 To $(vTableCount) -1&lt;/P&gt;&lt;P&gt;LET vMyTableName = Peek(‘TableNames’, $(i), ‘SQLTableList’);&lt;/P&gt;&lt;P&gt;$(vMyTableName):&lt;/P&gt;&lt;P&gt;SQL SELECT *FROM KQ0.KQ0$(vMyTableName);&lt;/P&gt;&lt;P&gt;STORE $(vMyTableName) INTO $(ExtractQVD)$(vMyTableName).QVD;&lt;/P&gt;&lt;P&gt;DROP Table $(vMyTableName);&lt;/P&gt;&lt;P&gt;Next i&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;End Sub;&lt;/P&gt;&lt;P&gt;Call LoadTableData;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Nov 2012 10:36:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-load-all-tables-from-sql-DB/m-p/450901#M1160042</guid>
      <dc:creator />
      <dc:date>2012-11-20T10:36:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to load all tables from sql DB?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-load-all-tables-from-sql-DB/m-p/450902#M1160043</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is not good practice to load all tables in a loop, because you don't actually require all the tables for report, also all columns in the tables are not required.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also in For loop the execution will be very slow.&amp;nbsp; In my view writing and loading the data manually from each table is best option.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Nov 2012 13:11:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-load-all-tables-from-sql-DB/m-p/450902#M1160043</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2012-11-20T13:11:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to load all tables from sql DB?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-load-all-tables-from-sql-DB/m-p/450903#M1160044</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Maybe I should told why I would like to do this. I´m searching for the table/s that holds the plain text. Most of the other fields in DB are just numbers. When extracting the "Table_Name" table and searching after the fields I´m looking for I can´t find them. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I understand that the operation will be slow and not best practice but the db aint so big so I beliwe it would work. &lt;/P&gt;&lt;P&gt;So back to my orginal question, anyone sees why the above loop don´t work?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Nov 2012 07:08:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-load-all-tables-from-sql-DB/m-p/450903#M1160044</guid>
      <dc:creator />
      <dc:date>2012-11-21T07:08:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to load all tables from sql DB?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-load-all-tables-from-sql-DB/m-p/450904#M1160045</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SQLTableList:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD "TABLE_NAME" as&amp;nbsp; TableNames;&lt;/P&gt;&lt;P&gt;SQL SELECT DISTINCT "TABLE_NAME"&lt;/P&gt;&lt;P&gt;FROM "INFORMATION_SCHEMA".COLUMNS;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let vTableCount = NoOfRows('SQLTableList');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let vTableCountQVD = 'dbo.[' &amp;amp; NoOfRows('SQLTableList') &amp;amp; ']';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For i = 0 To $(vTableCount) -1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vMyTableName = 'dbo.[' &amp;amp; Peek('TableNames', $(i), 'SQLTableList') &amp;amp; ']';&lt;/P&gt;&lt;P&gt;LET vMyTableNameQVD = Replace(Peek('TableNames', $(i), 'SQLTableList'), ' ', '');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$(vMyTableNameQVD):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SQL SELECT *FROM $(vMyTableName);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;STORE $(vMyTableNameQVD) INTO $(ExtractQVD)$(vMyTableNameQVD).QVD;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DROP Table $(vMyTableNameQVD);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Next i&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Nov 2012 10:08:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-load-all-tables-from-sql-DB/m-p/450904#M1160045</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2012-11-21T10:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to load all tables from sql DB?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-load-all-tables-from-sql-DB/m-p/450905#M1160046</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you try this code, it will bring back the DataType of each column it finds in the connection ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ODBC CONNECT TO {odbc name};&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SQLCOLUMNS;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this what you are looking for?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;flipside&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDIT:&amp;nbsp; Just add a preceding load to create a table you can then use in some dynamic script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ODBC CONNECT TO {connection}; //or oledb&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SQLTableColumns:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;load *;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SQLCOLUMNS; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You CAN also use a named table without the preceding load ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt;SQLTableColumns: SQLCOLUMNS; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... Script Editor shows this as an error but it does run.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Nov 2012 10:32:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-load-all-tables-from-sql-DB/m-p/450905#M1160046</guid>
      <dc:creator>flipside</dc:creator>
      <dc:date>2012-11-21T10:32:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to load all tables from sql DB?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-load-all-tables-from-sql-DB/m-p/450906#M1160047</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks. How can I do to load all tables in KQ0. **** ?&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ODBC CONNECT TO {connection}; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SQLTableColumns:&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;SQLCOLUMS in KQ0....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Nov 2012 13:27:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-load-all-tables-from-sql-DB/m-p/450906#M1160047</guid>
      <dc:creator />
      <dc:date>2012-11-22T13:27:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to load all tables from sql DB?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-load-all-tables-from-sql-DB/m-p/450907#M1160048</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good timing, I've been doing something very similar today, this is my code.&amp;nbsp; You can't filter the data returned by SQLCOLUMNS or SQLTYPES directly.&amp;nbsp; You have to run the code then move the data to another table and filter at that point ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ODBC CONNECT TO {connection};&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;AllODBCTables:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Load *;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SQLCOLUMNS;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ODBCDataTypes:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Load *;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SQLTYPES;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DISCONNECT;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ODBCTypes:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Load &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATA_TYPE as dtDataType,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; concat(TYPE_NAME,',') as dtTypeNameList //I have multiple options so am combining!!&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;resident ODBCDataTypes&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;group by DATA_TYPE;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ODBCTables:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //TABLE_QUALIFIER as tblQualifier, //no data&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TABLE_OWNER as tblOwner,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TABLE_NAME as tblName,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; COLUMN_NAME as tblColName,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATA_TYPE as tblColDataType,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //TYPE_NAME as tblColTypeName, //no data&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PRECISION as tblColPrecision,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LENGTH as tblColLength,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SCALE as tblColScale,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RADIX as tblColRadix,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NULLABLE as tblColNullble,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //REMARKS as tblColRmrks, //no data &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //EXTENDED_ID as tblColExtID, //no data&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATA_SOURCE as tblDSource&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;resident AllODBCTables where etc, etc;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;left join (ODBCTables)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dtDataType as tblColDataType,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dtTypeNameList&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;resident ODBCTypes;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DROP TABLES AllODBCTables, ODBCDataTypes, ODBCTypes;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This isn't loading any data, just the table structures.&amp;nbsp; Hope this helps ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;flipside&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Nov 2012 13:40:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-load-all-tables-from-sql-DB/m-p/450907#M1160048</guid>
      <dc:creator>flipside</dc:creator>
      <dc:date>2012-11-22T13:40:26Z</dc:date>
    </item>
  </channel>
</rss>

