<?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 Incremental Load using Record IDs in SQL script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Incremental-Load-using-Record-IDs-in-SQL-script/m-p/220926#M73783</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin: 0in 0in 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-outline-level: 2;"&gt;I have large database table (~40 Million Records) which adds almost 500,000 records a day.&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;I am creating Incremental load where I have loaded the 40 Millions records to one QVD file and planning to append to the QVD files the new records added everyday based on the new IDs only.&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;Here is how I am trying to do it:&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-outline-level: 2;"&gt;&lt;B&gt;First step:&lt;/B&gt; &lt;B&gt;load the saved QVD file of the historical data&lt;/B&gt;&lt;/P&gt;&lt;P&gt;CALLDROPS:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;num#(ID) as ID&lt;/P&gt;&lt;P&gt;,left(ID,6) as ID_DATE //this part will give me unformatted YYYYMM date ie: '201007'&lt;/P&gt;&lt;P&gt;,item1&lt;/P&gt;&lt;P&gt;,item2&lt;/P&gt;&lt;P&gt;FROM [..\QVD Data files\CALLDROPS.QVD] (qvd);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-outline-level: 2;"&gt;&lt;B&gt;Second step:&lt;/B&gt; &lt;B&gt;find the max ID_DATE (ID_DATE=YYYYMM)&lt;/B&gt;&lt;/P&gt;&lt;P&gt;CALLDROP_MAX_ID_DATE:&lt;/P&gt;&lt;P&gt;LOAD max(ID_DATE) as MaxID_DATE&lt;/P&gt;&lt;P&gt;Resident CALLDROPS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-outline-level: 2;"&gt;&lt;B&gt;Third step:&lt;/B&gt; &lt;B&gt;save the MaxID_DATE to a variable&lt;/B&gt;&lt;/P&gt;&lt;P&gt;Let vMaxIDDate= MaxID_DATE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-outline-level: 2;"&gt;&lt;B&gt;Forth step:&lt;/B&gt; &lt;B&gt;load connate to the historical QVD table&lt;/B&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;concatenate (CALLDROPS)&lt;/P&gt;&lt;P&gt;LOAD *&lt;/P&gt;&lt;P&gt;where not exists(ID);&lt;/P&gt;&lt;P&gt;SQL SELECT ID,&lt;/P&gt;&lt;P&gt;items 1,&lt;/P&gt;&lt;P&gt;items 2,&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;FROM database table&lt;/P&gt;&lt;P&gt;where SUBSTR(ID,1,8) &amp;gt;=$(MaxID_DATE);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Store CALLDROPS into "..\QVD Data files\CALLDROPS.QVD";&lt;/P&gt;&lt;P&gt;Drop TABLE CALLDROPS;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;B&gt;The part which is not working for me is the third step where when I display the variable value (which I use in the where statement ) is displays NULL.&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 12 Jul 2010 16:49:14 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-07-12T16:49:14Z</dc:date>
    <item>
      <title>Incremental Load using Record IDs in SQL script</title>
      <link>https://community.qlik.com/t5/QlikView/Incremental-Load-using-Record-IDs-in-SQL-script/m-p/220926#M73783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin: 0in 0in 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-outline-level: 2;"&gt;I have large database table (~40 Million Records) which adds almost 500,000 records a day.&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;I am creating Incremental load where I have loaded the 40 Millions records to one QVD file and planning to append to the QVD files the new records added everyday based on the new IDs only.&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;Here is how I am trying to do it:&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-outline-level: 2;"&gt;&lt;B&gt;First step:&lt;/B&gt; &lt;B&gt;load the saved QVD file of the historical data&lt;/B&gt;&lt;/P&gt;&lt;P&gt;CALLDROPS:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;num#(ID) as ID&lt;/P&gt;&lt;P&gt;,left(ID,6) as ID_DATE //this part will give me unformatted YYYYMM date ie: '201007'&lt;/P&gt;&lt;P&gt;,item1&lt;/P&gt;&lt;P&gt;,item2&lt;/P&gt;&lt;P&gt;FROM [..\QVD Data files\CALLDROPS.QVD] (qvd);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-outline-level: 2;"&gt;&lt;B&gt;Second step:&lt;/B&gt; &lt;B&gt;find the max ID_DATE (ID_DATE=YYYYMM)&lt;/B&gt;&lt;/P&gt;&lt;P&gt;CALLDROP_MAX_ID_DATE:&lt;/P&gt;&lt;P&gt;LOAD max(ID_DATE) as MaxID_DATE&lt;/P&gt;&lt;P&gt;Resident CALLDROPS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-outline-level: 2;"&gt;&lt;B&gt;Third step:&lt;/B&gt; &lt;B&gt;save the MaxID_DATE to a variable&lt;/B&gt;&lt;/P&gt;&lt;P&gt;Let vMaxIDDate= MaxID_DATE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-outline-level: 2;"&gt;&lt;B&gt;Forth step:&lt;/B&gt; &lt;B&gt;load connate to the historical QVD table&lt;/B&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;concatenate (CALLDROPS)&lt;/P&gt;&lt;P&gt;LOAD *&lt;/P&gt;&lt;P&gt;where not exists(ID);&lt;/P&gt;&lt;P&gt;SQL SELECT ID,&lt;/P&gt;&lt;P&gt;items 1,&lt;/P&gt;&lt;P&gt;items 2,&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;FROM database table&lt;/P&gt;&lt;P&gt;where SUBSTR(ID,1,8) &amp;gt;=$(MaxID_DATE);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Store CALLDROPS into "..\QVD Data files\CALLDROPS.QVD";&lt;/P&gt;&lt;P&gt;Drop TABLE CALLDROPS;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;B&gt;The part which is not working for me is the third step where when I display the variable value (which I use in the where statement ) is displays NULL.&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Jul 2010 16:49:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Incremental-Load-using-Record-IDs-in-SQL-script/m-p/220926#M73783</guid>
      <dc:creator />
      <dc:date>2010-07-12T16:49:14Z</dc:date>
    </item>
    <item>
      <title>Incremental Load using Record IDs in SQL script</title>
      <link>https://community.qlik.com/t5/QlikView/Incremental-Load-using-Record-IDs-in-SQL-script/m-p/220927#M73784</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, try changing this line&lt;/P&gt;&lt;P&gt;Let vMaxIDDate= MaxID_DATE&lt;/P&gt;&lt;P&gt;for this&lt;/P&gt;&lt;P&gt;Let vMaxIDDate= peek('MaxID_DATE',0,'CALLDROP_MAX_ID_DATE');&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds&lt;BR /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Jul 2010 16:58:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Incremental-Load-using-Record-IDs-in-SQL-script/m-p/220927#M73784</guid>
      <dc:creator>hector</dc:creator>
      <dc:date>2010-07-12T16:58:57Z</dc:date>
    </item>
    <item>
      <title>Incremental Load using Record IDs in SQL script</title>
      <link>https://community.qlik.com/t5/QlikView/Incremental-Load-using-Record-IDs-in-SQL-script/m-p/220928#M73785</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks alot. it works and I have passed this step. I will go ahead and test the next step and let you know &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Jul 2010 17:24:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Incremental-Load-using-Record-IDs-in-SQL-script/m-p/220928#M73785</guid>
      <dc:creator />
      <dc:date>2010-07-12T17:24:10Z</dc:date>
    </item>
  </channel>
</rss>

