Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

How to retrieve row ID after insert?

$
0
0

Hi all!

 

  I have a table that has 3 columns: ID, Name, LastVisit, wich are int, string, timestamp.  I'm inserting data in this table and I need to retrieve the ID I just inserted. Problem is that the ID is a sequence. What I am trying to do is:

 

var insertCmd = connection.prepareStatement('insert into "Test"."TestTable"("ID", "Name", "LastVisit") values(seq.NEXTVAL,?,?)');

insertCmd.setString(1,"Rodrigo");

insertCmd.setString(2,"2015-06-22 00:00:00");

var test = insertCmd.execute();

var rowId = test.getString(1);

 

  But I cannot get the rowId like I need to. Is there a way I can retrieve it? Thanks in advance!!


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>