×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
Why would you need to know this?
If you insert a row you can retrieve the value of the identity column just
generated by:
http://www-01.ibm.com/support/knowledgecenter/ssw_ibm_i_72/sqlp/rbafysfins.htm?lang=en-us
CREATE TABLE EMPSAMP
(EMPNO INTEGER GENERATED ALWAYS AS IDENTITY,
NAME CHAR(30),
SALARY DECIMAL(10,2),
DEPTNO SMALLINT,
LEVEL CHAR(30),
HIRETYPE VARCHAR(30) NOT NULL DEFAULT 'New Employee',
HIREDATE DATE NOT NULL WITH DEFAULT)
SELECT EMPNO, HIRETYPE, HIREDATE
FROM FINAL TABLE ( INSERT INTO EMPSAMP (NAME, SALARY, DEPTNO, LEVEL)
VALUES('Mary Smith', 35000.00, 11,
'Associate'))
Which is quite useful if you have an order header table with an identity
column and you want to use the new identity column on a related order line
table.
IDK if researching this will help: Identity Column Information
(Qdb_Qddfidcl)
http://www-01.ibm.com/support/knowledgecenter/ssw_ibm_i_72/apis/qdbrtvfd.htm?lang=en-us
Maybe searching for
Retrieve Database File Description (QDBRTVFD) API
might help. IDK if anyone has a sample using the offset for Identity
Column Information.
If this IS what you are looking for you can always request that IBM modify
one of the myriad DB2 catalogs to add this for you
Qddf_Id_ Curr_Start_With = Current START WITH value.
These catalogs sure beat the snot out of looking through all these API's.
Rob Berendt
As an Amazon Associate we earn from qualifying purchases.