Montag, 9. Juli 2012

DB2 - retrieve generated id



If you what to know the which ID was given to a record after an insert .

Record successfuly save with id: 815

e.g. insert into mytable (col1, col2, col3) values ( 'val1',  'val2', 'val3');

just calll

values identity_val_local();

it will return the last generated id.

e.g. 2

Keine Kommentare:

Kommentar veröffentlichen