<?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: Using DATEADD or GETDATE in SQL Query in Qlikview in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Using-DATEADD-or-GETDATE-in-SQL-Query-in-Qlikview/m-p/1727024#M722932</link>
    <description>&lt;P&gt;Hi, thanks for the suggestion.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get anerror when I try it. It seems to be the variable isn't working during the load.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;SQL##f - SqlState: S1000, ErrorCode: 1858, ErrorMsg: [Oracle][ODBC][Ora]ORA-01858: a non-numeric character was found where a numeric was expected

Fixtures:
SQL SELECT 
		sched.game_code "PK_gameId",
		sched.league_id "PK_leagueId",
		sched.season_id "PK_seasonId",  
		sched.game_date_ct "FIXTURE_gameDateTime",
		sched.home_team_name,
		sched.away_team_name,
		field.field_length_live,
		field.field_width_live,
		field.periods
		
	FROM customer_data.cd_soccer_schedule sched,
	customer_data.cd_soccer_games field,
	commercial.SOCCER_GAME_LOADED load
	
	WHERE   sched.season_id  IN (201949,201939)
	and     sched.game_code = field.game_code
	and 	load.table_type_id = 4
	AND 	load.GAME_CODE = sched.GAME_CODE
	AND 	load.GAME_CODE = field.GAME_CODE
	AND     load.LAST_UPDATE  &amp;lt; 'Date(Today()-7)'
	AND 	load.LOADED_STATUS = 1&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also tried changing SET to LET and get a different error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SQL##f - SqlState: S1000, ErrorCode: 1843, ErrorMsg: [Oracle][ODBC][Ora]ORA-01843: not a valid month&lt;/P&gt;&lt;P&gt;Fixtures:&lt;BR /&gt;SQL SELECT&lt;BR /&gt;sched.game_code "PK_gameId",&lt;BR /&gt;sched.league_id "PK_leagueId",&lt;BR /&gt;sched.season_id "PK_seasonId",&lt;BR /&gt;sched.game_date_ct "FIXTURE_gameDateTime",&lt;BR /&gt;sched.home_team_name,&lt;BR /&gt;sched.away_team_name,&lt;BR /&gt;field.field_length_live,&lt;BR /&gt;field.field_width_live,&lt;BR /&gt;field.periods&lt;BR /&gt;&lt;BR /&gt;FROM customer_data.cd_soccer_schedule sched,&lt;BR /&gt;customer_data.cd_soccer_games field,&lt;BR /&gt;commercial.SOCCER_GAME_LOADED load&lt;BR /&gt;&lt;BR /&gt;WHERE sched.season_id IN (201949,201939)&lt;BR /&gt;and sched.game_code = field.game_code&lt;BR /&gt;and load.table_type_id = 4&lt;BR /&gt;AND load.GAME_CODE = sched.GAME_CODE&lt;BR /&gt;AND load.GAME_CODE = field.GAME_CODE&lt;BR /&gt;AND load.LAST_UPDATE &amp;lt; '04/07/2020 12:00:00 AM'&lt;BR /&gt;AND load.LOADED_STATUS = 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also get the not a valid month error with&amp;nbsp;&lt;/P&gt;&lt;P&gt;AND TO_DATE( load.LAST_UPDATE, 'DD/MM/YYYY') &amp;lt; '$(vStartDate)'&lt;/P&gt;</description>
    <pubDate>Sat, 11 Jul 2020 12:48:56 GMT</pubDate>
    <dc:creator>AyCe1082</dc:creator>
    <dc:date>2020-07-11T12:48:56Z</dc:date>
    <item>
      <title>Using DATEADD or GETDATE in SQL Query in Qlikview</title>
      <link>https://community.qlik.com/t5/QlikView/Using-DATEADD-or-GETDATE-in-SQL-Query-in-Qlikview/m-p/1726937#M722928</link>
      <description>&lt;P&gt;Hi, I am trying to do an SQL query where load.LAST_UPDATED is within 7 days of the current date. I have seen many posts where people wanted the QV version of this but I need to have the SQL version work in the statement itself during a load. I keep getting invalid identifier errors or missing right parenthesis errors.&lt;/P&gt;&lt;P&gt;I have tried&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;load.LAST_UPDATE &amp;lt; DateAdd(m, -7, GetDate())&amp;nbsp;&lt;/P&gt;&lt;P&gt;load.LAST_UPDATE &amp;lt; GetDate()-7&lt;/P&gt;&lt;P&gt;and also tried putting the second half of each of those lines in extra parenthesis. Nothing seems to work in Qlikview.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 00:20:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-DATEADD-or-GETDATE-in-SQL-Query-in-Qlikview/m-p/1726937#M722928</guid>
      <dc:creator>AyCe1082</dc:creator>
      <dc:date>2024-11-16T00:20:43Z</dc:date>
    </item>
    <item>
      <title>Re: Using DATEADD or GETDATE in SQL Query in Qlikview</title>
      <link>https://community.qlik.com/t5/QlikView/Using-DATEADD-or-GETDATE-in-SQL-Query-in-Qlikview/m-p/1726954#M722929</link>
      <description>&lt;P&gt;We would have to see the entire SQL LOAD statement.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jul 2020 18:42:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-DATEADD-or-GETDATE-in-SQL-Query-in-Qlikview/m-p/1726954#M722929</guid>
      <dc:creator>JustinDallas</dc:creator>
      <dc:date>2020-07-10T18:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: Using DATEADD or GETDATE in SQL Query in Qlikview</title>
      <link>https://community.qlik.com/t5/QlikView/Using-DATEADD-or-GETDATE-in-SQL-Query-in-Qlikview/m-p/1726958#M722930</link>
      <description>&lt;P&gt;No problem. I don't think there is anything too sensitive here.&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;Fixtures:
SQL SELECT 
	sched.game_code "PK_gameId",
	sched.league_id "PK_leagueId",
	sched.season_id "PK_seasonId",  
	sched.game_date_ct "FIXTURE_gameDateTime",
	sched.home_team_name,
	sched.away_team_name,
	field.field_length_live,
	field.field_width_live,
	field.periods,
	load.LAST_UPDATE,
        DateAdd(m, -3, GetDate())
		
	FROM customer_data.cd_soccer_schedule sched,
	customer_data.cd_soccer_games field,
	commercial.SOCCER_GAME_LOADED load
	
	WHERE   sched.season_id  IN (201949,201939)
	AND     sched.game_code = field.game_code
	AND 	load.table_type_id = 4
	AND 	load.GAME_CODE = sched.GAME_CODE
	AND 	load.GAME_CODE = field.GAME_CODE
	AND     load.LAST_UPDATE &amp;lt; DateAdd(m, -7, GetDate())
	AND 	load.LOADED_STATUS = 1;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The final statement will be larger and pull a lot of data. LAST_UPDATE is in the format DD/MM/YYYY hh:mm:ss AM/PM&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jul 2020 18:54:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-DATEADD-or-GETDATE-in-SQL-Query-in-Qlikview/m-p/1726958#M722930</guid>
      <dc:creator>AyCe1082</dc:creator>
      <dc:date>2020-07-10T18:54:29Z</dc:date>
    </item>
    <item>
      <title>Re: Using DATEADD or GETDATE in SQL Query in Qlikview</title>
      <link>https://community.qlik.com/t5/QlikView/Using-DATEADD-or-GETDATE-in-SQL-Query-in-Qlikview/m-p/1727012#M722931</link>
      <description>&lt;P&gt;Hi, you can create a variable using Qlikview syntax to set the date you want to start load, and use this variable in Sql statement using $(varName), like:&lt;/P&gt;&lt;P&gt;SET vStartDate = Date(Today()-7);&amp;nbsp; // substracts 7 days from today&lt;/P&gt;&lt;P&gt;SQL SELECT ...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;AND load.LAST_UPDATE &amp;lt; '$(vStartDate)'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In your current sql statement&amp;nbsp; I think you need to use 'd' instead of 'm'&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;DateAdd(d, -7, GetDate())&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 11 Jul 2020 10:29:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-DATEADD-or-GETDATE-in-SQL-Query-in-Qlikview/m-p/1727012#M722931</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2020-07-11T10:29:37Z</dc:date>
    </item>
    <item>
      <title>Re: Using DATEADD or GETDATE in SQL Query in Qlikview</title>
      <link>https://community.qlik.com/t5/QlikView/Using-DATEADD-or-GETDATE-in-SQL-Query-in-Qlikview/m-p/1727024#M722932</link>
      <description>&lt;P&gt;Hi, thanks for the suggestion.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get anerror when I try it. It seems to be the variable isn't working during the load.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;SQL##f - SqlState: S1000, ErrorCode: 1858, ErrorMsg: [Oracle][ODBC][Ora]ORA-01858: a non-numeric character was found where a numeric was expected

Fixtures:
SQL SELECT 
		sched.game_code "PK_gameId",
		sched.league_id "PK_leagueId",
		sched.season_id "PK_seasonId",  
		sched.game_date_ct "FIXTURE_gameDateTime",
		sched.home_team_name,
		sched.away_team_name,
		field.field_length_live,
		field.field_width_live,
		field.periods
		
	FROM customer_data.cd_soccer_schedule sched,
	customer_data.cd_soccer_games field,
	commercial.SOCCER_GAME_LOADED load
	
	WHERE   sched.season_id  IN (201949,201939)
	and     sched.game_code = field.game_code
	and 	load.table_type_id = 4
	AND 	load.GAME_CODE = sched.GAME_CODE
	AND 	load.GAME_CODE = field.GAME_CODE
	AND     load.LAST_UPDATE  &amp;lt; 'Date(Today()-7)'
	AND 	load.LOADED_STATUS = 1&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also tried changing SET to LET and get a different error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SQL##f - SqlState: S1000, ErrorCode: 1843, ErrorMsg: [Oracle][ODBC][Ora]ORA-01843: not a valid month&lt;/P&gt;&lt;P&gt;Fixtures:&lt;BR /&gt;SQL SELECT&lt;BR /&gt;sched.game_code "PK_gameId",&lt;BR /&gt;sched.league_id "PK_leagueId",&lt;BR /&gt;sched.season_id "PK_seasonId",&lt;BR /&gt;sched.game_date_ct "FIXTURE_gameDateTime",&lt;BR /&gt;sched.home_team_name,&lt;BR /&gt;sched.away_team_name,&lt;BR /&gt;field.field_length_live,&lt;BR /&gt;field.field_width_live,&lt;BR /&gt;field.periods&lt;BR /&gt;&lt;BR /&gt;FROM customer_data.cd_soccer_schedule sched,&lt;BR /&gt;customer_data.cd_soccer_games field,&lt;BR /&gt;commercial.SOCCER_GAME_LOADED load&lt;BR /&gt;&lt;BR /&gt;WHERE sched.season_id IN (201949,201939)&lt;BR /&gt;and sched.game_code = field.game_code&lt;BR /&gt;and load.table_type_id = 4&lt;BR /&gt;AND load.GAME_CODE = sched.GAME_CODE&lt;BR /&gt;AND load.GAME_CODE = field.GAME_CODE&lt;BR /&gt;AND load.LAST_UPDATE &amp;lt; '04/07/2020 12:00:00 AM'&lt;BR /&gt;AND load.LOADED_STATUS = 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also get the not a valid month error with&amp;nbsp;&lt;/P&gt;&lt;P&gt;AND TO_DATE( load.LAST_UPDATE, 'DD/MM/YYYY') &amp;lt; '$(vStartDate)'&lt;/P&gt;</description>
      <pubDate>Sat, 11 Jul 2020 12:48:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-DATEADD-or-GETDATE-in-SQL-Query-in-Qlikview/m-p/1727024#M722932</guid>
      <dc:creator>AyCe1082</dc:creator>
      <dc:date>2020-07-11T12:48:56Z</dc:date>
    </item>
    <item>
      <title>Re: Using DATEADD or GETDATE in SQL Query in Qlikview</title>
      <link>https://community.qlik.com/t5/QlikView/Using-DATEADD-or-GETDATE-in-SQL-Query-in-Qlikview/m-p/1727032#M722933</link>
      <description>&lt;P&gt;Hi, yes sorry, it should be with LET.&lt;/P&gt;&lt;P&gt;Have you tried?:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;AND load.LAST_UPDATE &amp;lt; TO_DATE($(vStartDate),'DD/MM/YYYY')&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Jul 2020 15:27:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-DATEADD-or-GETDATE-in-SQL-Query-in-Qlikview/m-p/1727032#M722933</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2020-07-11T15:27:57Z</dc:date>
    </item>
    <item>
      <title>Re: Using DATEADD or GETDATE in SQL Query in Qlikview</title>
      <link>https://community.qlik.com/t5/QlikView/Using-DATEADD-or-GETDATE-in-SQL-Query-in-Qlikview/m-p/1727033#M722934</link>
      <description>&lt;P&gt;Unfortunately it just gives this error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SQL##f - SqlState: S1000, ErrorCode: 1858, ErrorMsg: [Oracle][ODBC][Ora]ORA-01858: a non-numeric character was found where a numeric was expected&lt;/P&gt;&lt;P&gt;Fixtures:&lt;BR /&gt;SQL SELECT&lt;BR /&gt;sched.game_code "PK_gameId",&lt;BR /&gt;sched.league_id "PK_leagueId",&lt;BR /&gt;sched.season_id "PK_seasonId",&lt;BR /&gt;sched.game_date_ct "FIXTURE_gameDateTime",&lt;BR /&gt;sched.home_team_name,&lt;BR /&gt;sched.away_team_name,&lt;BR /&gt;field.field_length_live,&lt;BR /&gt;field.field_width_live,&lt;BR /&gt;field.periods&lt;BR /&gt;&lt;BR /&gt;FROM customer_data.cd_soccer_schedule sched,&lt;BR /&gt;customer_data.cd_soccer_games field,&lt;BR /&gt;commercial.SOCCER_GAME_LOADED load&lt;BR /&gt;&lt;BR /&gt;WHERE sched.season_id IN (201949,201939)&lt;BR /&gt;and sched.game_code = field.game_code&lt;BR /&gt;and load.table_type_id = 4&lt;BR /&gt;AND load.GAME_CODE = sched.GAME_CODE&lt;BR /&gt;AND load.GAME_CODE = field.GAME_CODE&lt;BR /&gt;AND load.LAST_UPDATE &amp;lt; TO_DATE(04/07/2020,'DD/MM/YYYY')&lt;BR /&gt;AND load.LOADED_STATUS = 1&lt;/P&gt;</description>
      <pubDate>Sat, 11 Jul 2020 15:55:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-DATEADD-or-GETDATE-in-SQL-Query-in-Qlikview/m-p/1727033#M722934</guid>
      <dc:creator>AyCe1082</dc:creator>
      <dc:date>2020-07-11T15:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: Using DATEADD or GETDATE in SQL Query in Qlikview</title>
      <link>https://community.qlik.com/t5/QlikView/Using-DATEADD-or-GETDATE-in-SQL-Query-in-Qlikview/m-p/1727035#M722935</link>
      <description>&lt;P&gt;This is what worked in the end:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;LET vStartDate = Date(Today()-3,'DD-MMM-YYYY'); // substracts 7 days from today&lt;/P&gt;&lt;P&gt;while using TRUNC() in the where clause in the SQL load.&lt;/P&gt;&lt;P&gt;Apparently oracle did not like the date format and would only work if I changed it to the format 04-Jul-2020.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Jul 2020 16:58:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-DATEADD-or-GETDATE-in-SQL-Query-in-Qlikview/m-p/1727035#M722935</guid>
      <dc:creator>AyCe1082</dc:creator>
      <dc:date>2020-07-11T16:58:38Z</dc:date>
    </item>
  </channel>
</rss>

