<?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: SQL Create and Insert Table and join to qvd in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/SQL-Create-and-Insert-Table-and-join-to-qvd/m-p/825039#M666679</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;BR /&gt; I observe that your procedure is inserting records in database, so you should use ODBC connection in write mode and enable "Open Database in read and write mode" from settings.&lt;BR /&gt;Ex.: ODBC CONNECT TO [DB](Mode is write); Use ODBC connection in QliK View script and open the conneciton in Write mode&lt;BR /&gt; ex.:ODBC CONNECT TO [DB](Mode is write)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 13 Mar 2015 07:10:37 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-03-13T07:10:37Z</dc:date>
    <item>
      <title>SQL Create and Insert Table and join to qvd</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-Create-and-Insert-Table-and-join-to-qvd/m-p/825034#M666674</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I have a payments table that is showing the max number of payments a customer has made and if they are still paying or they have cancelled:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Customer ID&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;# Payments&lt;BR /&gt;&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Payment Status&lt;BR /&gt;&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;123&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;4&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Cancelled&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;456&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;5&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Paying&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;789&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Paying&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;012&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Cancelled&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I want to see a row for ever time they pay:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e.g:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Customer ID&lt;BR /&gt;&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Payment&lt;BR /&gt;&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Payment Status&lt;BR /&gt;&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;123&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Paid&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;123&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Paid&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;123&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Paid&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;123&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;4&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Cancelled&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;456&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Paid&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;456&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Paid&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;456&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Paid&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;456&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;4&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Paid&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;456&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;5&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Paid&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;789&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Paid&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;789&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Paid&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;012&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Cancelled&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In SQL I have been able to use a Create Table and Insert Into:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE TABLE #num&lt;/P&gt;&lt;P&gt;( i INT NOT NULL&lt;/P&gt;&lt;P&gt;, PRIMARY KEY &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/info.png" /&gt;&lt;/P&gt;&lt;P&gt;) ; &lt;/P&gt;&lt;P&gt;INSERT INTO #num &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/info.png" /&gt;&lt;/P&gt;&lt;P&gt;VALUES&lt;/P&gt;&lt;P&gt;&amp;nbsp; (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11), (12), (13), (14), (15), (16), (17), (18), &lt;/P&gt;&lt;P&gt;&amp;nbsp; (19), (20), (21), (22), (23), (24), (25), (26), (27), (28), (29), (30), (31), (32), (33), (34), (35), (36),&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; (37), (38), (39), (40), (41), (42), (43), (44), (45), (46), (47), (48), (49), (50), (51), (52), (53), (54)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That I then join to my payments table by joining on the max number of payments and looking up the status:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select t.*, #num.i as [Tenure Month], &lt;/P&gt;&lt;P&gt;case when t.[NumberOfPayments] = #num.i then t.[PaymentStatus] else 'Paid' end as [PaymentStatus]&lt;/P&gt;&lt;P&gt;from &lt;/P&gt;&lt;P&gt;Payments t&lt;/P&gt;&lt;P&gt;join #num &lt;/P&gt;&lt;P&gt;on #num.i &amp;lt;= t.[NumberOfPayments]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I cannot get this to work in Qlikview! The problem seems to be with the create and insert statements.&lt;/P&gt;&lt;P&gt;Any help would be much appreciated!&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Dec 2014 16:10:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-Create-and-Insert-Table-and-join-to-qvd/m-p/825034#M666674</guid>
      <dc:creator />
      <dc:date>2014-12-12T16:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Create and Insert Table and join to qvd</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-Create-and-Insert-Table-and-join-to-qvd/m-p/825035#M666675</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;What is the database ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;What is the Language? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;are you using only SQL?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Dec 2014 16:38:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-Create-and-Insert-Table-and-join-to-qvd/m-p/825035#M666675</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-12-12T16:38:51Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Create and Insert Table and join to qvd</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-Create-and-Insert-Table-and-join-to-qvd/m-p/825036#M666676</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is an SQL database and I have got the script to work in SQL but when i try and do the same in qlikview the "sql create table..." and "sql insert into..." statements error&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Dec 2014 16:44:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-Create-and-Insert-Table-and-join-to-qvd/m-p/825036#M666676</guid>
      <dc:creator />
      <dc:date>2014-12-12T16:44:45Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Create and Insert Table and join to qvd</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-Create-and-Insert-Table-and-join-to-qvd/m-p/825037#M666677</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;First build store procedures in your database that do what you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then execute store procedures doing sql exec yourstoreprocedure &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;go to edit script&lt;/P&gt;&lt;P&gt;settings&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check open databases in read and write mode~&lt;/P&gt;&lt;P&gt;check can execute external programs&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think that's enough!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;André Gomes&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Dec 2014 16:51:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-Create-and-Insert-Table-and-join-to-qvd/m-p/825037#M666677</guid>
      <dc:creator>agomes1971</dc:creator>
      <dc:date>2014-12-12T16:51:52Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Create and Insert Table and join to qvd</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-Create-and-Insert-Table-and-join-to-qvd/m-p/825038#M666678</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Avoid stored procedures for this kind of process.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stored procedures are Database dependent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Antonio Caria&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Dec 2014 16:54:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-Create-and-Insert-Table-and-join-to-qvd/m-p/825038#M666678</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-12-12T16:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Create and Insert Table and join to qvd</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-Create-and-Insert-Table-and-join-to-qvd/m-p/825039#M666679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;BR /&gt; I observe that your procedure is inserting records in database, so you should use ODBC connection in write mode and enable "Open Database in read and write mode" from settings.&lt;BR /&gt;Ex.: ODBC CONNECT TO [DB](Mode is write); Use ODBC connection in QliK View script and open the conneciton in Write mode&lt;BR /&gt; ex.:ODBC CONNECT TO [DB](Mode is write)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Mar 2015 07:10:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-Create-and-Insert-Table-and-join-to-qvd/m-p/825039#M666679</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-03-13T07:10:37Z</dc:date>
    </item>
  </channel>
</rss>

