<?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>article Qlik Replicate and MySQL source: How to handle zero date in Official Support Articles</title>
    <link>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Replicate-and-MySQL-source-How-to-handle-zero-date/ta-p/2121603</link>
    <description>&lt;P&gt;MySQL allows the zero date (and/or zero month) in data rows, which is a specific behaviour of MySQL and does not exist in most other RDBMS. This behaviour causes invalid date errors while replicating data to heterogeneous databases.&lt;/P&gt;
&lt;P&gt;In this article, we will explain the solutions in both Full Load and CDC stages.&lt;/P&gt;
&lt;H3&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Resolution&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H3&gt;
&lt;P&gt;To handle &lt;EM&gt;zero date&lt;/EM&gt; in Qlik Replicate for both Full Load and CDC stages:&lt;/P&gt;
&lt;H4&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;How to handle zero date in Full Load stage&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;P&gt;MySQL provides an &lt;A title="ODBC parameter" href="https://dev.mysql.com/doc/connectors/en/connector-odbc-configuration-connection-parameters.html#:~:text=ZERO_DATE_TO_MIN,Added%20in%203.51.17." target="_blank" rel="noopener"&gt;ODBC parameter&lt;/A&gt;&amp;nbsp;&lt;FONT face="courier new,courier"&gt;ZERO_DATE_TO_MIN&lt;/FONT&gt; to control this behavior.&amp;nbsp;please take note MySQL adds one day for zero date values.&lt;/P&gt;
&lt;OL&gt;
&lt;LI class="lia-align-justify"&gt;Open&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;MySQL source endpoint&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Go to the&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Advanced&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;tab&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;Go to the &lt;STRONG&gt;Additional ODBC connection properties&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;Add below connection string in the input label:&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;BR /&gt;ZERO_DATE_TO_MIN=1;&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT face="courier new,courier"&gt;&lt;FONT face="courier new,courier"&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;SPAN class="uiOutputText"&gt;Based on this setting, the Full Load stage gets a non-zero date. For example, the source value &lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;2022-12-00&lt;/FONT&gt;&lt;SPAN class="uiOutputText"&gt;&amp;nbsp;in MySQL will become &lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;2022-12-01&lt;/FONT&gt;&lt;SPAN class="uiOutputText"&gt;&amp;nbsp;in the target endpoint after the Full Load is finished.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="zero_date_to_min parameter.png" style="width: 939px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/116979iEE856F9CB5BB217B/image-size/large?v=v2&amp;amp;px=999" role="button" title="zero_date_to_min parameter.png" alt="zero_date_to_min parameter.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;H4&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;How to handle zero date in CDC stage&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;P&gt;The &lt;EM&gt;Full Load&amp;nbsp;&lt;/EM&gt;steps will not have an impact&amp;nbsp;on the CDC stage. That means the source value &lt;FONT face="courier new,courier"&gt;2022-12-00&lt;/FONT&gt;&amp;nbsp;will be&amp;nbsp;&lt;FONT face="courier new,courier"&gt;2022-12-00&lt;/FONT&gt;&amp;nbsp;still in the CDC stage. To mitigate this, we need to create a transformation to replace the zero date &lt;FONT face="courier new,courier"&gt;00&lt;/FONT&gt;&amp;nbsp;with &lt;FONT face="courier new,courier"&gt;01&lt;/FONT&gt;&amp;nbsp;as we do in the Full Load stage.&lt;/P&gt;
&lt;P&gt;The simple global transformation expression can be:&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT face="courier new,courier"&gt;date(substr($AR_M_SOURCE_COLUMN_DATA,1,8)||replace(substr($AR_M_SOURCE_COLUMN_DATA,9,2),'00','01'))&lt;BR /&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="create tranformation rule.png" style="width: 818px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/116980i791BF3B8CC5E95D8/image-size/large?v=v2&amp;amp;px=999" role="button" title="create tranformation rule.png" alt="create tranformation rule.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;For more information on how to set transformations, see:&amp;nbsp;&lt;A href="https://help.qlik.com/en-US/replicate/Content/Global_Common/Content/SharedEMReplicate/Customize%20Tasks/tasks_newTransRuleWiz.htm#Starting%20the%20Global%20Transformation%20Rules%20wizard" target="_blank" rel="noopener"&gt;Starting the Global Transformation Rules wizard&lt;/A&gt;.&lt;/P&gt;
&lt;H3&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Related Content&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H3&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;A title="Transformation: Date Time - Invalid Value - MySQL" href="https://community.qlik.com/t5/Official-Support-Articles/Transformation-Date-Time-Invalid-Value-MySQL/ta-p/1826202" target="_blank" rel="noopener"&gt;Transformation: Date Time - Invalid Value - MySQL&lt;/A&gt;&lt;/P&gt;
&lt;H3&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Environment&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H3&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;LI-PRODUCT title="Qlik Replicate" id="qlikReplicate"&gt;&lt;/LI-PRODUCT&gt;&amp;nbsp;all versions&lt;BR /&gt;MySQL all versions&lt;/P&gt;
&lt;H3&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Internal Investigation ID(s)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H3&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;Support case #00107317&lt;/P&gt;</description>
    <pubDate>Mon, 25 Sep 2023 12:03:41 GMT</pubDate>
    <dc:creator>john_wang</dc:creator>
    <dc:date>2023-09-25T12:03:41Z</dc:date>
    <item>
      <title>Qlik Replicate and MySQL source: How to handle zero date</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Replicate-and-MySQL-source-How-to-handle-zero-date/ta-p/2121603</link>
      <description>&lt;P&gt;MySQL allows the zero date (and/or zero month) in data rows, which is a specific behaviour of MySQL and does not exist in most other RDBMS. This behaviour causes invalid date errors while replicating data to heterogeneous databases.&lt;/P&gt;
&lt;P&gt;In this article, we will explain the solutions in both Full Load and CDC stages.&lt;/P&gt;
&lt;H3&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Resolution&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H3&gt;
&lt;P&gt;To handle &lt;EM&gt;zero date&lt;/EM&gt; in Qlik Replicate for both Full Load and CDC stages:&lt;/P&gt;
&lt;H4&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;How to handle zero date in Full Load stage&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;P&gt;MySQL provides an &lt;A title="ODBC parameter" href="https://dev.mysql.com/doc/connectors/en/connector-odbc-configuration-connection-parameters.html#:~:text=ZERO_DATE_TO_MIN,Added%20in%203.51.17." target="_blank" rel="noopener"&gt;ODBC parameter&lt;/A&gt;&amp;nbsp;&lt;FONT face="courier new,courier"&gt;ZERO_DATE_TO_MIN&lt;/FONT&gt; to control this behavior.&amp;nbsp;please take note MySQL adds one day for zero date values.&lt;/P&gt;
&lt;OL&gt;
&lt;LI class="lia-align-justify"&gt;Open&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;MySQL source endpoint&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Go to the&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Advanced&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;tab&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;Go to the &lt;STRONG&gt;Additional ODBC connection properties&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;Add below connection string in the input label:&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;BR /&gt;ZERO_DATE_TO_MIN=1;&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT face="courier new,courier"&gt;&lt;FONT face="courier new,courier"&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;SPAN class="uiOutputText"&gt;Based on this setting, the Full Load stage gets a non-zero date. For example, the source value &lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;2022-12-00&lt;/FONT&gt;&lt;SPAN class="uiOutputText"&gt;&amp;nbsp;in MySQL will become &lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;2022-12-01&lt;/FONT&gt;&lt;SPAN class="uiOutputText"&gt;&amp;nbsp;in the target endpoint after the Full Load is finished.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="zero_date_to_min parameter.png" style="width: 939px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/116979iEE856F9CB5BB217B/image-size/large?v=v2&amp;amp;px=999" role="button" title="zero_date_to_min parameter.png" alt="zero_date_to_min parameter.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;H4&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;How to handle zero date in CDC stage&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;P&gt;The &lt;EM&gt;Full Load&amp;nbsp;&lt;/EM&gt;steps will not have an impact&amp;nbsp;on the CDC stage. That means the source value &lt;FONT face="courier new,courier"&gt;2022-12-00&lt;/FONT&gt;&amp;nbsp;will be&amp;nbsp;&lt;FONT face="courier new,courier"&gt;2022-12-00&lt;/FONT&gt;&amp;nbsp;still in the CDC stage. To mitigate this, we need to create a transformation to replace the zero date &lt;FONT face="courier new,courier"&gt;00&lt;/FONT&gt;&amp;nbsp;with &lt;FONT face="courier new,courier"&gt;01&lt;/FONT&gt;&amp;nbsp;as we do in the Full Load stage.&lt;/P&gt;
&lt;P&gt;The simple global transformation expression can be:&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT face="courier new,courier"&gt;date(substr($AR_M_SOURCE_COLUMN_DATA,1,8)||replace(substr($AR_M_SOURCE_COLUMN_DATA,9,2),'00','01'))&lt;BR /&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="create tranformation rule.png" style="width: 818px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/116980i791BF3B8CC5E95D8/image-size/large?v=v2&amp;amp;px=999" role="button" title="create tranformation rule.png" alt="create tranformation rule.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;For more information on how to set transformations, see:&amp;nbsp;&lt;A href="https://help.qlik.com/en-US/replicate/Content/Global_Common/Content/SharedEMReplicate/Customize%20Tasks/tasks_newTransRuleWiz.htm#Starting%20the%20Global%20Transformation%20Rules%20wizard" target="_blank" rel="noopener"&gt;Starting the Global Transformation Rules wizard&lt;/A&gt;.&lt;/P&gt;
&lt;H3&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Related Content&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H3&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;A title="Transformation: Date Time - Invalid Value - MySQL" href="https://community.qlik.com/t5/Official-Support-Articles/Transformation-Date-Time-Invalid-Value-MySQL/ta-p/1826202" target="_blank" rel="noopener"&gt;Transformation: Date Time - Invalid Value - MySQL&lt;/A&gt;&lt;/P&gt;
&lt;H3&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Environment&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H3&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;LI-PRODUCT title="Qlik Replicate" id="qlikReplicate"&gt;&lt;/LI-PRODUCT&gt;&amp;nbsp;all versions&lt;BR /&gt;MySQL all versions&lt;/P&gt;
&lt;H3&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Internal Investigation ID(s)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H3&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;Support case #00107317&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2023 12:03:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Replicate-and-MySQL-source-How-to-handle-zero-date/ta-p/2121603</guid>
      <dc:creator>john_wang</dc:creator>
      <dc:date>2023-09-25T12:03:41Z</dc:date>
    </item>
  </channel>
</rss>

