<?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: tMSSQL_LastInsertID returning 0 after changing Select @@IDENTITY to SCOOE_IDENTITY in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/tMSSQL-LastInsertID-returning-0-after-changing-Select-IDENTITY/m-p/2360348#M124953</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;Thanks for sharing your solution with us. We will appreciate it if you could post your select statement on forum.&lt;/P&gt;
&lt;P&gt;Best regards&lt;/P&gt;
&lt;P&gt;Sabrina&lt;/P&gt;</description>
    <pubDate>Wed, 29 Aug 2018 03:55:48 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-08-29T03:55:48Z</dc:date>
    <item>
      <title>tMSSQL_LastInsertID returning 0 after changing Select @@IDENTITY to SCOOE_IDENTITY</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tMSSQL-LastInsertID-returning-0-after-changing-Select-IDENTITY/m-p/2360345#M124950</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;Im having an issue where tMSSQLLastInsertID object is returning a 0 after changing the code located here:&lt;/P&gt;
&lt;P&gt;\Talend\Talend\Studio\plugins\org.talend.designer.components.localprovider_6.5.1.20180116_1512\components\tMSSqlLastInsertId\tMSSqlLastInsertId_begin.javajet&lt;/P&gt;
&lt;P&gt;to the following:&lt;/P&gt;
&lt;P&gt;&amp;lt;%&lt;BR /&gt;log4jCodeGenerateUtil.useExistConnection(node);&lt;BR /&gt;log4jCodeGenerateUtil.logInfo(node,"info",cid + " - Query:'&lt;FONT color="#0000FF"&gt;SELECT @@IDENTITY&lt;/FONT&gt;'");&lt;BR /&gt;%&amp;gt;&lt;BR /&gt;java.sql.PreparedStatement pstmt_&amp;lt;%=cid %&amp;gt; = conn_&amp;lt;%=cid %&amp;gt;.prepareStatement("SELECT &lt;FONT color="#FF6600"&gt;SCOPE_IDENTITY() as 'last_insert_id&lt;/FONT&gt;'");&lt;BR /&gt;int nb_line_&amp;lt;%=cid%&amp;gt; = 0;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a trigger on the table and that is why I need to change to Scope_Identity instead of using&amp;nbsp;@@identity. &amp;nbsp;When I use&amp;nbsp;@@identity it returns the incorect ID. &amp;nbsp;With the change I made above it returns 0, I have also tried just SCOPE_IDENTITY() without the as and it also returns 0. &amp;nbsp;I have also tried select SCOPE_IDENTITY() in the line above in blue still returns 0.&lt;/P&gt;
&lt;P&gt;The ID field is a bigint that is auto incrementing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help would be greatly appreciated&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 08:10:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tMSSQL-LastInsertID-returning-0-after-changing-Select-IDENTITY/m-p/2360345#M124950</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T08:10:00Z</dc:date>
    </item>
    <item>
      <title>Re: tMSSQL_LastInsertID returning 0 after changing Select @@IDENTITY to SCOOE_IDENTITY</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tMSSQL-LastInsertID-returning-0-after-changing-Select-IDENTITY/m-p/2360346#M124951</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;Please try to disable "Use Batch Size" in the tMSSqlOutput component that does the insert.&lt;/P&gt;
&lt;P&gt;Let us know if it is OK with you.&lt;/P&gt;
&lt;P&gt;Best regards&lt;/P&gt;
&lt;P&gt;Sabrina&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 09:54:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tMSSQL-LastInsertID-returning-0-after-changing-Select-IDENTITY/m-p/2360346#M124951</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-08-28T09:54:55Z</dc:date>
    </item>
    <item>
      <title>Re: tMSSQL_LastInsertID returning 0 after changing Select @@IDENTITY to SCOOE_IDENTITY</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tMSSQL-LastInsertID-returning-0-after-changing-Select-IDENTITY/m-p/2360347#M124952</link>
      <description>&lt;P&gt;I already had that disabled and for future reference or anyone who comes across this post...We opened up the java for the tMSSQLOutput component and found that it closes the connection to the database after the record is inserted and the tMSSQL_LastInsert makes a second call to the database so there is no way it can accurately get the last insert ID for the exact record that was inserted into that table. &amp;nbsp;&lt;/P&gt;&lt;P&gt;In order to solve this issue we actually make a 2nd call to the database to get the ID of the record inserted using a select statement and in the where clause 2 fields that make the record unique. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 11:59:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tMSSQL-LastInsertID-returning-0-after-changing-Select-IDENTITY/m-p/2360347#M124952</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-08-28T11:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: tMSSQL_LastInsertID returning 0 after changing Select @@IDENTITY to SCOOE_IDENTITY</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tMSSQL-LastInsertID-returning-0-after-changing-Select-IDENTITY/m-p/2360348#M124953</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;Thanks for sharing your solution with us. We will appreciate it if you could post your select statement on forum.&lt;/P&gt;
&lt;P&gt;Best regards&lt;/P&gt;
&lt;P&gt;Sabrina&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 03:55:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tMSSQL-LastInsertID-returning-0-after-changing-Select-IDENTITY/m-p/2360348#M124953</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-08-29T03:55:48Z</dc:date>
    </item>
  </channel>
</rss>

