<?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: How to get last inserted id in DB2? in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/How-to-get-last-inserted-id-in-DB2/m-p/2340997#M108980</link>
    <description>The best way is to get the new id first with a tDB2Row (within a flow + tParseRecordSet) and use this new id directly.
&lt;BR /&gt;All other ways are not really reliable.</description>
    <pubDate>Wed, 03 Jun 2015 21:35:14 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-06-03T21:35:14Z</dc:date>
    <item>
      <title>How to get last inserted id in DB2?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-get-last-inserted-id-in-DB2/m-p/2340996#M108979</link>
      <description>Hello,&lt;BR /&gt;Anyone has an idea on how to get last inserted id in DB2?&lt;BR /&gt;I have two tables in db2, one child, one parent. I would like to insert data into one table, and get the id (which auto generated in the db2,) then insert the id into another table as a foreign key.&lt;BR /&gt;Thanks.</description>
      <pubDate>Wed, 03 Jun 2015 18:50:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-get-last-inserted-id-in-DB2/m-p/2340996#M108979</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-03T18:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to get last inserted id in DB2?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-get-last-inserted-id-in-DB2/m-p/2340997#M108980</link>
      <description>The best way is to get the new id first with a tDB2Row (within a flow + tParseRecordSet) and use this new id directly.
&lt;BR /&gt;All other ways are not really reliable.</description>
      <pubDate>Wed, 03 Jun 2015 21:35:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-get-last-inserted-id-in-DB2/m-p/2340997#M108980</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-03T21:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to get last inserted id in DB2?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-get-last-inserted-id-in-DB2/m-p/2340998#M108981</link>
      <description>Hi jlolling, 
&lt;BR /&gt;Thanks for taking time to answer my question. 
&lt;BR /&gt;Do you mean get the new id before insert any data into the first table? My table is an existing table, and id is designed to auto-generated by database. I don't think I can change it now. 
&lt;BR /&gt;If I misunderstood your meaning, could you please explain a little bit more. 
&lt;BR /&gt;Thanks!</description>
      <pubDate>Wed, 03 Jun 2015 21:56:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-get-last-inserted-id-in-DB2/m-p/2340998#M108981</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-03T21:56:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to get last inserted id in DB2?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-get-last-inserted-id-in-DB2/m-p/2340999#M108982</link>
      <description>In this case you cannot follow my last advise.&amp;nbsp;&lt;BR /&gt;Ok try this:&lt;BR /&gt;Within the same connection and same transaction use tDB2Input with this select:&lt;BR /&gt;&lt;PRE&gt;SELECT SYSIBM.IDENTITY_VAL_LOCAL() AS id FROM my_schema.my_table&lt;/PRE&gt;&lt;BR /&gt;Hope it works. I have not tested it yet.</description>
      <pubDate>Wed, 03 Jun 2015 22:16:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-get-last-inserted-id-in-DB2/m-p/2340999#M108982</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-03T22:16:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to get last inserted id in DB2?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-get-last-inserted-id-in-DB2/m-p/2341000#M108983</link>
      <description>Yes. I used this one. It works.
&lt;BR /&gt;SELECT Identity_val_Local() as &amp;nbsp;id FROM sysibm.sysdummy1
&lt;BR /&gt;Thanks for giving me the clue, jlolling.</description>
      <pubDate>Thu, 04 Jun 2015 18:13:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-get-last-inserted-id-in-DB2/m-p/2341000#M108983</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-04T18:13:07Z</dc:date>
    </item>
  </channel>
</rss>

