<?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 Check if table exist in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Check-if-table-exist/m-p/159062#M33862</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;IF NoOfRows('temptable') &amp;gt; 0 THEN&lt;BR /&gt; DROP TABLE temptable;&lt;BR /&gt;END IF&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 25 Feb 2010 00:53:57 GMT</pubDate>
    <dc:creator>rwunderlich</dc:creator>
    <dc:date>2010-02-25T00:53:57Z</dc:date>
    <item>
      <title>Check if table exist</title>
      <link>https://community.qlik.com/t5/QlikView/Check-if-table-exist/m-p/159061#M33861</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;BR /&gt;I've created a temporary table, TempTable, and can you please tell me the syntax if the table exists so I can drop it before&lt;BR /&gt;creating a new one?&lt;/P&gt;&lt;P&gt;Can someone please show me the syntax on how to check if the table exists?&lt;BR /&gt;if exists('temptable)&lt;BR /&gt; drop table temptable;&lt;BR /&gt;end if&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Feb 2010 00:23:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Check-if-table-exist/m-p/159061#M33861</guid>
      <dc:creator />
      <dc:date>2010-02-25T00:23:39Z</dc:date>
    </item>
    <item>
      <title>Check if table exist</title>
      <link>https://community.qlik.com/t5/QlikView/Check-if-table-exist/m-p/159062#M33862</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;IF NoOfRows('temptable') &amp;gt; 0 THEN&lt;BR /&gt; DROP TABLE temptable;&lt;BR /&gt;END IF&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Feb 2010 00:53:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Check-if-table-exist/m-p/159062#M33862</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2010-02-25T00:53:57Z</dc:date>
    </item>
    <item>
      <title>Check if table exist</title>
      <link>https://community.qlik.com/t5/QlikView/Check-if-table-exist/m-p/159063#M33863</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rob&lt;/P&gt;&lt;P&gt;Thanks for the quick response but when I put the code, I get the SCRIPT LINE ERROR of&lt;/P&gt;&lt;P&gt;"IF NoOfRows('temptable') &amp;gt; 0'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Reyn&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Feb 2010 01:27:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Check-if-table-exist/m-p/159063#M33863</guid>
      <dc:creator />
      <dc:date>2010-02-25T01:27:52Z</dc:date>
    </item>
    <item>
      <title>Check if table exist</title>
      <link>https://community.qlik.com/t5/QlikView/Check-if-table-exist/m-p/159064#M33864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you post the entire script block without adding any quotes? It should work. What version QV?&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Feb 2010 03:41:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Check-if-table-exist/m-p/159064#M33864</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2010-02-25T03:41:09Z</dc:date>
    </item>
    <item>
      <title>Check if table exist</title>
      <link>https://community.qlik.com/t5/QlikView/Check-if-table-exist/m-p/159065#M33865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rob,&lt;BR /&gt;Thank you very much for your help on this matter. MY QlikView is version 9 and here's my script.&lt;/P&gt;&lt;P&gt;Let varMinDate = num(Peek('OrderDate',0,'Orders'));&lt;BR /&gt;Let varMaxDate = num(Peek('OrderDate',-1,'Orders'));&lt;BR /&gt;Let varToday = num(today());&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;IF NoOfRows('temptable') &amp;gt; 0 THEN&lt;BR /&gt; DROP TABLE temptable;&lt;BR /&gt;END IF&lt;/P&gt;&lt;P&gt;temptable:&lt;BR /&gt;Load&lt;BR /&gt; $(varMinDate) + rowno() - 1 as num&lt;BR /&gt; , date($(varMinDate) + rowno() -1) as TempDate&lt;BR /&gt;AUTOGENERATE&lt;BR /&gt; $(varMaxDate) - $(varMinDate) + 1;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Sincerely,&lt;BR /&gt;Reyn&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Feb 2010 17:59:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Check-if-table-exist/m-p/159065#M33865</guid>
      <dc:creator />
      <dc:date>2010-02-25T17:59:52Z</dc:date>
    </item>
    <item>
      <title>Check if table exist</title>
      <link>https://community.qlik.com/t5/QlikView/Check-if-table-exist/m-p/159066#M33866</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It looks ok to me. Can you post the portion of the document log where the error message appears?&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Feb 2010 01:13:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Check-if-table-exist/m-p/159066#M33866</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2010-02-26T01:13:01Z</dc:date>
    </item>
    <item>
      <title>Check if table exist</title>
      <link>https://community.qlik.com/t5/QlikView/Check-if-table-exist/m-p/159067#M33867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Rob,&lt;/P&gt;&lt;P&gt;A came across your solution and it worked perfectly except when I had an empty table (no rows).&lt;/P&gt;&lt;P&gt;So another approach is to use the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;if not isnull(TableNumber('temptable')) then&lt;BR /&gt; drop table temptable;&lt;BR /&gt;end if&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;This will drop temptable if it exists wether it has 0 or more rows.&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Henrik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Mar 2010 09:53:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Check-if-table-exist/m-p/159067#M33867</guid>
      <dc:creator />
      <dc:date>2010-03-08T09:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: Check if table exist</title>
      <link>https://community.qlik.com/t5/QlikView/Check-if-table-exist/m-p/159068#M33868</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As a reaction on henke_steen, I've created a subfunction.&lt;/P&gt;&lt;P&gt;You could place your SUBS in a separate tab in your load script or use the include method and place this script in an QVS file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P style="font-size: 13.3333px;"&gt;SUB DROPTABLES(vDropTableName)&lt;/P&gt;
&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;
&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;
&lt;P style="font-size: 13.3333px;"&gt;// DROPS table if exist in memory.&lt;/P&gt;
&lt;P style="font-size: 13.3333px;"&gt;// Normal operation in Qlikview is to create an error if table not exists or has 0 records&lt;/P&gt;
&lt;P style="font-size: 13.3333px;"&gt;// Input&amp;nbsp; : tablename&lt;/P&gt;
&lt;P style="font-size: 13.3333px;"&gt;// Usage&amp;nbsp; : CALL DROPTABLES('Table Name')&lt;/P&gt;
&lt;P style="font-size: 13.3333px;"&gt;// Author : Roland Raijmakers&lt;/P&gt;
&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;
&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;IF NOT ISNULL(TableNumber(vDropTableName)) THEN&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Let vNoRows=NoOfRows(vDropTableName);&lt;/P&gt;
&lt;P style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TRACE DROP EMPTY TABLE: DROP Table '$(vDropTableName)'&amp;nbsp; CONTAINS: $(vNoRows) Rows ;&lt;/P&gt;
&lt;P style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DROP Table '$(vDropTableName)';&lt;/P&gt;
&lt;P style="font-size: 13.3333px;"&gt;ENDIF&lt;/P&gt;
&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;
&lt;P style="font-size: 13.3333px;"&gt;END SUB&lt;/P&gt;

&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2018 08:58:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Check-if-table-exist/m-p/159068#M33868</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-10-11T08:58:04Z</dc:date>
    </item>
  </channel>
</rss>

