<?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 Using tDBOutput as a MERGE in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Using-tDBOutput-as-a-MERGE/m-p/2377889#M139700</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;In a SQL Server MERGE command, we define 3 things in the UPDATE part :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) the Keys columns to compare to see if it's an Update or an Insert&lt;/P&gt;&lt;P&gt;2) the columns to compare to know if the Update is necessary&lt;/P&gt;&lt;P&gt;3) the columns that will be updated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let's imagine that I got the following columns in my Source and Target tables :&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Id&lt;/LI&gt;&lt;LI&gt;Value&lt;/LI&gt;&lt;LI&gt;Update_DateTime&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my MERGE I can say :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if Target.&lt;B&gt;Id &lt;/B&gt;= Source.&lt;B&gt;Id&lt;/B&gt; then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;if Target.&lt;B&gt;Value &lt;/B&gt;&amp;lt;&amp;gt; Source.&lt;B&gt;Value &lt;/B&gt;then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Target.&lt;B&gt;Value &lt;/B&gt;= Source.&lt;B&gt;Value&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Target.&lt;B&gt;Update_DateTime&lt;/B&gt; = Source.&lt;B&gt;Update_DateTime&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the &lt;B&gt;Update_DateTime &lt;/B&gt;column is not tested in the condition but will be updated if Target.&lt;B&gt;Value &lt;/B&gt;&amp;lt;&amp;gt; Source.&lt;B&gt;Value&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I try to use a tDBOutput component to do the same in Talend, I need to specify the Key column (&lt;B&gt;Id&lt;/B&gt;) and the tested columns (&lt;B&gt;Value&lt;/B&gt; and &lt;B&gt;Update_DateTime&lt;/B&gt;) but, in this case, the condition will always be true because the &lt;B&gt;Update_DateTime&lt;/B&gt; will always be different. Then all the rows will always be updated, even if the &lt;B&gt;Value&lt;/B&gt; is still the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Other option, specify the Key column (&lt;B&gt;Id&lt;/B&gt;) and the tested columns (&lt;B&gt;Value&lt;/B&gt; only) but, in this case, the &lt;B&gt;Update_DateTime&lt;/B&gt; column won't be updated if the &lt;B&gt;Value&lt;/B&gt; has changed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I saw that there is a "Use field options" in the Advanced settings of the tDBOutp component but not sure I can use it to solve my problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does someone got an idea for me to solve my issue ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not sure if my explanation is clear enough, otherwise don't hesitate to ask.&lt;/P&gt;</description>
    <pubDate>Fri, 15 Nov 2024 23:15:12 GMT</pubDate>
    <dc:creator>manuk1</dc:creator>
    <dc:date>2024-11-15T23:15:12Z</dc:date>
    <item>
      <title>Using tDBOutput as a MERGE</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Using-tDBOutput-as-a-MERGE/m-p/2377889#M139700</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;In a SQL Server MERGE command, we define 3 things in the UPDATE part :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) the Keys columns to compare to see if it's an Update or an Insert&lt;/P&gt;&lt;P&gt;2) the columns to compare to know if the Update is necessary&lt;/P&gt;&lt;P&gt;3) the columns that will be updated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let's imagine that I got the following columns in my Source and Target tables :&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Id&lt;/LI&gt;&lt;LI&gt;Value&lt;/LI&gt;&lt;LI&gt;Update_DateTime&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my MERGE I can say :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if Target.&lt;B&gt;Id &lt;/B&gt;= Source.&lt;B&gt;Id&lt;/B&gt; then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;if Target.&lt;B&gt;Value &lt;/B&gt;&amp;lt;&amp;gt; Source.&lt;B&gt;Value &lt;/B&gt;then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Target.&lt;B&gt;Value &lt;/B&gt;= Source.&lt;B&gt;Value&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Target.&lt;B&gt;Update_DateTime&lt;/B&gt; = Source.&lt;B&gt;Update_DateTime&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the &lt;B&gt;Update_DateTime &lt;/B&gt;column is not tested in the condition but will be updated if Target.&lt;B&gt;Value &lt;/B&gt;&amp;lt;&amp;gt; Source.&lt;B&gt;Value&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I try to use a tDBOutput component to do the same in Talend, I need to specify the Key column (&lt;B&gt;Id&lt;/B&gt;) and the tested columns (&lt;B&gt;Value&lt;/B&gt; and &lt;B&gt;Update_DateTime&lt;/B&gt;) but, in this case, the condition will always be true because the &lt;B&gt;Update_DateTime&lt;/B&gt; will always be different. Then all the rows will always be updated, even if the &lt;B&gt;Value&lt;/B&gt; is still the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Other option, specify the Key column (&lt;B&gt;Id&lt;/B&gt;) and the tested columns (&lt;B&gt;Value&lt;/B&gt; only) but, in this case, the &lt;B&gt;Update_DateTime&lt;/B&gt; column won't be updated if the &lt;B&gt;Value&lt;/B&gt; has changed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I saw that there is a "Use field options" in the Advanced settings of the tDBOutp component but not sure I can use it to solve my problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does someone got an idea for me to solve my issue ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not sure if my explanation is clear enough, otherwise don't hesitate to ask.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 23:15:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Using-tDBOutput-as-a-MERGE/m-p/2377889#M139700</guid>
      <dc:creator>manuk1</dc:creator>
      <dc:date>2024-11-15T23:15:12Z</dc:date>
    </item>
    <item>
      <title>Re: Using tDBOutput as a MERGE</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Using-tDBOutput-as-a-MERGE/m-p/2377890#M139701</link>
      <description>&lt;P&gt;Hi, you can use tSQLTemplateMerge to reproduce SSMS merge: &lt;/P&gt;&lt;P&gt;https://help.talend.com/r/en-US/7.3/sqltemplate/tsqltemplatemerge&lt;/P&gt;&lt;P&gt;Send me love and kudos&lt;/P&gt;</description>
      <pubDate>Wed, 02 Feb 2022 15:38:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Using-tDBOutput-as-a-MERGE/m-p/2377890#M139701</guid>
      <dc:creator>gjeremy1617088143</dc:creator>
      <dc:date>2022-02-02T15:38:44Z</dc:date>
    </item>
    <item>
      <title>Re: Using tDBOutput as a MERGE</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Using-tDBOutput-as-a-MERGE/m-p/2377891#M139702</link>
      <description>&lt;P&gt;Thanks for answering, &lt;B&gt;gjeremy1617088143&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I knew the tSQLTemplateMerge component but it seems there are issues sometimes, depending of the Database type.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also used a tSQLRow to execute a MERGE statement without issues but no statistics about the rows inserted/updated are enable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That's why I would like to know if a tDBOutput can allow me to simulate a MERGE.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Feb 2022 19:24:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Using-tDBOutput-as-a-MERGE/m-p/2377891#M139702</guid>
      <dc:creator>manuk1</dc:creator>
      <dc:date>2022-02-02T19:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Using tDBOutput as a MERGE</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Using-tDBOutput-as-a-MERGE/m-p/2377892#M139703</link>
      <description>&lt;P&gt;Is it possible to use the "Additional Columns" option, to update my &lt;B&gt;Update_DateTime&lt;/B&gt; column ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000N4SpNAAV.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/138777iF3B0E662FFCE0F39/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000N4SpNAAV.jpg" alt="0695b00000N4SpNAAV.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 07:18:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Using-tDBOutput-as-a-MERGE/m-p/2377892#M139703</guid>
      <dc:creator>manuk1</dc:creator>
      <dc:date>2022-02-03T07:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: Using tDBOutput as a MERGE</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Using-tDBOutput-as-a-MERGE/m-p/2377893#M139704</link>
      <description>&lt;P&gt;this link can be helpfull :&lt;/P&gt;&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/48110549/get-output-of-tmssqlrow-in-talend" alt="https://stackoverflow.com/questions/48110549/get-output-of-tmssqlrow-in-talend" target="_blank"&gt;https://stackoverflow.com/questions/48110549/get-output-of-tmssqlrow-in-talend&lt;/A&gt;&lt;/P&gt;&lt;P&gt;So with tDBRow you have to explicitly return in your query the number of line affected then use a tParseRecorSet to parse the object returned by the tDBRow.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 08:24:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Using-tDBOutput-as-a-MERGE/m-p/2377893#M139704</guid>
      <dc:creator>gjeremy1617088143</dc:creator>
      <dc:date>2022-02-03T08:24:27Z</dc:date>
    </item>
    <item>
      <title>Re: Using tDBOutput as a MERGE</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Using-tDBOutput-as-a-MERGE/m-p/2377894#M139705</link>
      <description>&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it's not possible to use this method in my case. With a &lt;U&gt;MERGE&lt;/U&gt; command the same instruction will INSERT or UPDATE depending if the ID is still present in the target table. So, I can probably know the total impacted rows but not how many rows were updated and how many rows were inserted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 13:05:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Using-tDBOutput-as-a-MERGE/m-p/2377894#M139705</guid>
      <dc:creator>manuk1</dc:creator>
      <dc:date>2022-02-03T13:05:39Z</dc:date>
    </item>
  </channel>
</rss>

