<?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>Question Re: Days Between function SAP HANA in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/days-between-function-sap-hana/qaa-p/12675916#M4755887</link>
    <description>&lt;P&gt;It will work with a scalar user defined function. For example...&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CREATE OR REPLACE FUNCTION my_time_udf&lt;BR /&gt;RETURNS retval DATE LANGUAGE SQLSCRIPT AS&lt;BR /&gt;BEGIN&lt;BR /&gt;  retval = current_timestamp;&lt;BR /&gt;END;
&lt;BR /&gt;SELECT&lt;BR /&gt;	*&lt;BR /&gt;FROM&lt;BR /&gt;	tables&lt;BR /&gt;WHERE&lt;BR /&gt;	DAYS_BETWEEN(CREATE_TIME, my_time_udf()) &amp;gt; 0&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 10 Feb 2023 07:59:27 GMT</pubDate>
    <dc:creator>michael_eaton3</dc:creator>
    <dc:date>2023-02-10T07:59:27Z</dc:date>
    <item>
      <title>Days Between function SAP HANA</title>
      <link>https://community.sap.com/t5/technology-q-a/days-between-function-sap-hana/qaq-p/12675908</link>
      <description>&lt;P&gt;Hello Guys,&lt;/P&gt;
  &lt;P&gt;I'm trying to alert a query that will function if the U_DFrom table is less than 30 days to U_DTo table. Since Im new to Hana the usual Datediff will not work and im getting error using DAYS_BETWEEN function. Cannot find any example that the DATE_BETWEEN is in Where section.&lt;/P&gt;
  &lt;P&gt;Thanks for the help.&lt;/P&gt;
  &lt;P&gt;Here is my code.&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;SELECT T0."U_ComN", T0."U_ContN", T0."U_DFrom", T0."U_DTo", T0."U_Remarks" FROM "LIVEDB"."@ITDOCMAS" T0 WHERE DAYS_BETWEEN (TO_DATE (T0."U_DFrom", 'MM/DD/YYYY'), TO_DATE(T0."U_DTo", 'MM/DD/YYYY'))&amp;lt; '30'&amp;lt;br&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Feb 2023 08:51:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/days-between-function-sap-hana/qaq-p/12675908</guid>
      <dc:creator>former_member351438</dc:creator>
      <dc:date>2023-02-09T08:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: Days Between function SAP HANA</title>
      <link>https://community.sap.com/t5/technology-q-a/days-between-function-sap-hana/qaa-p/12675909#M4755880</link>
      <description>&lt;P&gt;It's always helpful to provide the error message.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2023 09:43:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/days-between-function-sap-hana/qaa-p/12675909#M4755880</guid>
      <dc:creator>michael_eaton3</dc:creator>
      <dc:date>2023-02-09T09:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: Days Between function SAP HANA</title>
      <link>https://community.sap.com/t5/technology-q-a/days-between-function-sap-hana/qaa-p/12675910#M4755881</link>
      <description>&lt;P&gt;&lt;SPAN class="mention-scrubbed"&gt;clay005&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;You don't need to use the DATE_BETWEEN function for this. Instead, use the DATEDIFF function.
&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT 
  U_DFrom,
  U_DTo
FROM 
  Table
WHERE
  DATEDIFF('DAY', U_DFrom, U_DTo) &amp;lt; 30
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;
The above query will return all rows where the difference between the two column values is less than 30 days.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2023 09:46:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/days-between-function-sap-hana/qaa-p/12675910#M4755881</guid>
      <dc:creator>Yogananda</dc:creator>
      <dc:date>2023-02-09T09:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: Days Between function SAP HANA</title>
      <link>https://community.sap.com/t5/technology-q-a/days-between-function-sap-hana/qaa-p/12675911#M4755882</link>
      <description>&lt;P&gt;A DATEDIFF function does not exist in any supported version of SAP HANA.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2023 09:52:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/days-between-function-sap-hana/qaa-p/12675911#M4755882</guid>
      <dc:creator>michael_eaton3</dc:creator>
      <dc:date>2023-02-09T09:52:42Z</dc:date>
    </item>
    <item>
      <title>Re: Days Between function SAP HANA</title>
      <link>https://community.sap.com/t5/technology-q-a/days-between-function-sap-hana/qaa-p/12675912#M4755883</link>
      <description>&lt;P&gt;It is possible to use in the WHERE clause, for example&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SELECT&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;	*&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FROM&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;	tables&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WHERE&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;	DAYS_BETWEEN(CREATE_TIME, '2022-02-08 01:00:00') &amp;gt; 0&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2023 10:00:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/days-between-function-sap-hana/qaa-p/12675912#M4755883</guid>
      <dc:creator>michael_eaton3</dc:creator>
      <dc:date>2023-02-09T10:00:48Z</dc:date>
    </item>
    <item>
      <title>Re: Days Between function SAP HANA</title>
      <link>https://community.sap.com/t5/technology-q-a/days-between-function-sap-hana/qaa-p/12675913#M4755884</link>
      <description>&lt;P&gt;could you remove the quotes '30' -&amp;gt; 30 as &lt;A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abensql_date_func.htm#!ABAP_VARIANT_8@8@"&gt;days_between&lt;/A&gt; returns an integer ?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2023 11:33:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/days-between-function-sap-hana/qaa-p/12675913#M4755884</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2023-02-09T11:33:47Z</dc:date>
    </item>
    <item>
      <title>Re: Days Between function SAP HANA</title>
      <link>https://community.sap.com/t5/technology-q-a/days-between-function-sap-hana/qaa-p/12675914#M4755885</link>
      <description>&lt;P&gt;  &lt;SPAN class="mention-scrubbed"&gt;michael.eaton3&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;U_Dfrom and U_Dto are both UDF and as Date type.&lt;/P&gt;&lt;P&gt;This is the error.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;[SAP AG][LIBODBCHDB DLL][HDBODBC] General Error;303 invalid DATE, TIME or TIMESTAMP value: exception 71000303: SQL Error 'Received Alerts' (OAIB)&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 Feb 2023 06:15:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/days-between-function-sap-hana/qaa-p/12675914#M4755885</guid>
      <dc:creator>former_member351438</dc:creator>
      <dc:date>2023-02-10T06:15:32Z</dc:date>
    </item>
    <item>
      <title>Re: Days Between function SAP HANA</title>
      <link>https://community.sap.com/t5/technology-q-a/days-between-function-sap-hana/qaa-p/12675915#M4755886</link>
      <description>&lt;P&gt;This will not work in SAP Hana. I just wish SAP keep it that way.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2023 06:21:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/days-between-function-sap-hana/qaa-p/12675915#M4755886</guid>
      <dc:creator>former_member351438</dc:creator>
      <dc:date>2023-02-10T06:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: Days Between function SAP HANA</title>
      <link>https://community.sap.com/t5/technology-q-a/days-between-function-sap-hana/qaa-p/12675916#M4755887</link>
      <description>&lt;P&gt;It will work with a scalar user defined function. For example...&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CREATE OR REPLACE FUNCTION my_time_udf&lt;BR /&gt;RETURNS retval DATE LANGUAGE SQLSCRIPT AS&lt;BR /&gt;BEGIN&lt;BR /&gt;  retval = current_timestamp;&lt;BR /&gt;END;
&lt;BR /&gt;SELECT&lt;BR /&gt;	*&lt;BR /&gt;FROM&lt;BR /&gt;	tables&lt;BR /&gt;WHERE&lt;BR /&gt;	DAYS_BETWEEN(CREATE_TIME, my_time_udf()) &amp;gt; 0&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 Feb 2023 07:59:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/days-between-function-sap-hana/qaa-p/12675916#M4755887</guid>
      <dc:creator>michael_eaton3</dc:creator>
      <dc:date>2023-02-10T07:59:27Z</dc:date>
    </item>
    <item>
      <title>Re: Days Between function SAP HANA</title>
      <link>https://community.sap.com/t5/technology-q-a/days-between-function-sap-hana/qaa-p/12675917#M4755888</link>
      <description>&lt;P&gt;Me too. I hope that SAP hana can support DATEDIFF function.How do you calculate the date difference without DATEDIFF?&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 03:11:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/days-between-function-sap-hana/qaa-p/12675917#M4755888</guid>
      <dc:creator>wenxi_liu49</dc:creator>
      <dc:date>2023-02-15T03:11:43Z</dc:date>
    </item>
    <item>
      <title>Re: Days Between function SAP HANA</title>
      <link>https://community.sap.com/t5/technology-q-a/days-between-function-sap-hana/qaa-p/12675918#M4755889</link>
      <description>&lt;P&gt;The TO_DATE function is not used properly in your statement and that's why it returns an error. You should exclude the formatting 'MM/DD/YYYY'&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;WHERE DAYS_BETWEEN (TO_DATE (T0."U_DFrom"), TO_DATE(T0."U_DTo"))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Just make sure that columns U_DFrom and U_DTo store valid date values&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 15:49:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/days-between-function-sap-hana/qaa-p/12675918#M4755889</guid>
      <dc:creator>KonradZaleski</dc:creator>
      <dc:date>2023-02-22T15:49:54Z</dc:date>
    </item>
    <item>
      <title>Re: Days Between function SAP HANA</title>
      <link>https://community.sap.com/t5/technology-q-a/days-between-function-sap-hana/qaa-p/12675919#M4755890</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;WHERE DAYS_BETWEEN (T0."U_DFrom", T0."U_DTo") &amp;lt; 30;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Son Tran&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2023 10:47:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/days-between-function-sap-hana/qaa-p/12675919#M4755890</guid>
      <dc:creator>SonTran</dc:creator>
      <dc:date>2023-02-23T10:47:41Z</dc:date>
    </item>
  </channel>
</rss>

