Hi,
You'll get the last identity column inserted in your job with the SQL scalar
function Identity_Val_Local (without any parameters).
In Release V6R1 you may get the indentities for a block insert as follows:
Select MyIdentity
From Final Table (Insert into MyTable (Fld1, Fld2, ... Fldx)
Select Flda, FldB, .... FldX
from OtherTable
Where ....) as x
Your insert gets embedded in a Select-Statement.
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im
Auftrag von Rick.Chevalier@xxxxxxxxxxxxxxx
Gesendet: Wednesday, November 05, 2008 17:57
An: rpg400-l@xxxxxxxxxxxx
Betreff: Retrieving identity column value when adding a record
I am looking at using an identity column as the primary key for one of the
tables in a new process. When a record is added to the table using RPG I
need to pass the identity column value off to another program via a data
queue. My question is how do I know what value was assigned to the identity
column for the added record?
I searched the archives and found references to the VALUES statement but the
documentation says it can only be used in a trigger. Am I missing
something?
Rick Chevalier
Privileged and Confidential. This e-mail, and any attachments there to, is
intended only for use by the addressee(s) named herein and may contain
privileged or confidential information. If you have received this e-mail in
error, please notify me immediately by a return e-mail and delete this
e-mail. You are hereby notified that any dissemination, distribution or
copying of this e-mail and/or any attachments thereto, is strictly
prohibited.
As an Amazon Associate we earn from qualifying purchases.