<?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 How to add Date Criteria in Data Loader Editor SQL Script in Connectivity &amp; Data Prep</title>
    <link>https://community.qlik.com/t5/Connectivity-Data-Prep/How-to-add-Date-Criteria-in-Data-Loader-Editor-SQL-Script/m-p/1378999#M2986</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am new to Qilk Sense and having challenge trying to create a SQL script that will only load records where it Effective Date &amp;lt;= SYDATE &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following is my script&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;LOAD `sls_tty_id`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `bsn_ar_grp_id`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `eff_ts`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `xpry_ts`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `sls_tty_xtnd_nm`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `bsn_ar_grp_nm`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `st_bag_cust_sgm_cd`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `st_bag_cust_sgm_nm`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `st_bag_sls_cvrg_sgm_cd`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `st_bag_sls_cvrg_sgm_nm`;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;SQL SELECT DISTINCT `sls_tty_id`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `bsn_ar_grp_id`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `eff_ts`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `xpry_ts`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `sls_tty_xtnd_nm`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `bsn_ar_grp_nm`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `st_bag_cust_sgm_cd`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `st_bag_cust_sgm_nm`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `st_bag_sls_cvrg_sgm_cd`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `st_bag_sls_cvrg_sgm_nm`&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;FROM HIVE.`ea_shared`.`st_bag_cust_pfl_dmnsn_rw_ext`&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;WHERE (Date(`eff_ts`, 'M/D/YYYY h:mm:ss TT') &amp;lt;= Date(Today(2),'M/D/YYYY'));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I am getting the following error that Today is a invalid function&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; font-family: monospace; font-size: 13px;"&gt;Connector reply error: SQL##f - SqlState: S1000, ErrorCode: 80, ErrorMsg: [Hortonworks][Hardy] (80) Syntax or semantic analysis error thrown in server while executing query. Error message from server: Error while compiling statement: FAILED: SemanticException [Error 10011]: Line 12:53 Invalid function 'Today'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 13px; font-family: monospace;"&gt;Even if I hardcode a date, I end up loading 0 records&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; font-family: monospace; font-size: 13px;"&gt;&lt;SPAN style="color: #339966; font-size: 13.3333px;"&gt;WHERE (Date(`eff_ts`, 'M/D/YYYY h:mm:ss TT') &amp;lt;= Date('10/17/2017 12:00:00 AM','&lt;SPAN style="color: #339966; font-family: monospace; font-size: 13.3333px;"&gt;M/D/YYYY h:mm:ss TT&lt;/SPAN&gt;'));&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #339966; font-size: 13.3333px; font-family: monospace;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; font-family: monospace; font-size: 13px;"&gt;&lt;SPAN style="color: #000000; font-size: 13px; font-family: monospace;"&gt;Would appreciate if the community can share your experience working with dates in your data loader scripts.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Oct 2017 04:38:41 GMT</pubDate>
    <dc:creator />
    <dc:date>2017-10-17T04:38:41Z</dc:date>
    <item>
      <title>How to add Date Criteria in Data Loader Editor SQL Script</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/How-to-add-Date-Criteria-in-Data-Loader-Editor-SQL-Script/m-p/1378999#M2986</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am new to Qilk Sense and having challenge trying to create a SQL script that will only load records where it Effective Date &amp;lt;= SYDATE &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following is my script&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;LOAD `sls_tty_id`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `bsn_ar_grp_id`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `eff_ts`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `xpry_ts`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `sls_tty_xtnd_nm`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `bsn_ar_grp_nm`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `st_bag_cust_sgm_cd`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `st_bag_cust_sgm_nm`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `st_bag_sls_cvrg_sgm_cd`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `st_bag_sls_cvrg_sgm_nm`;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;SQL SELECT DISTINCT `sls_tty_id`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `bsn_ar_grp_id`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `eff_ts`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `xpry_ts`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `sls_tty_xtnd_nm`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `bsn_ar_grp_nm`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `st_bag_cust_sgm_cd`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `st_bag_cust_sgm_nm`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `st_bag_sls_cvrg_sgm_cd`,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `st_bag_sls_cvrg_sgm_nm`&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;FROM HIVE.`ea_shared`.`st_bag_cust_pfl_dmnsn_rw_ext`&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3cb371;"&gt;WHERE (Date(`eff_ts`, 'M/D/YYYY h:mm:ss TT') &amp;lt;= Date(Today(2),'M/D/YYYY'));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I am getting the following error that Today is a invalid function&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; font-family: monospace; font-size: 13px;"&gt;Connector reply error: SQL##f - SqlState: S1000, ErrorCode: 80, ErrorMsg: [Hortonworks][Hardy] (80) Syntax or semantic analysis error thrown in server while executing query. Error message from server: Error while compiling statement: FAILED: SemanticException [Error 10011]: Line 12:53 Invalid function 'Today'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 13px; font-family: monospace;"&gt;Even if I hardcode a date, I end up loading 0 records&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; font-family: monospace; font-size: 13px;"&gt;&lt;SPAN style="color: #339966; font-size: 13.3333px;"&gt;WHERE (Date(`eff_ts`, 'M/D/YYYY h:mm:ss TT') &amp;lt;= Date('10/17/2017 12:00:00 AM','&lt;SPAN style="color: #339966; font-family: monospace; font-size: 13.3333px;"&gt;M/D/YYYY h:mm:ss TT&lt;/SPAN&gt;'));&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #339966; font-size: 13.3333px; font-family: monospace;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; font-family: monospace; font-size: 13px;"&gt;&lt;SPAN style="color: #000000; font-size: 13px; font-family: monospace;"&gt;Would appreciate if the community can share your experience working with dates in your data loader scripts.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Oct 2017 04:38:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/How-to-add-Date-Criteria-in-Data-Loader-Editor-SQL-Script/m-p/1378999#M2986</guid>
      <dc:creator />
      <dc:date>2017-10-17T04:38:41Z</dc:date>
    </item>
  </channel>
</rss>

