0

Hi any one can help me on this issue which i have problem insert a dynamic value which is from previous database table value to pass to another table in Katalon.

Please find my information below:-

  1. This screenshot is ab.dbo.DOCUMENT table which DOCUMENT_ID is auto populate with value which mean it will appear random number by itself.

enter image description here

  1. Another screenshot is bc.dbo.DOCUMENT_IC table which i need to manually key in DOCUMENT_ID in the value base on on what it is given from ab.dbo.DOCUMENT table DOCUMENT_ID. Attached of a screenshot for bc.dbo.DOCUMENT_IC

enter image description here

  1. In Katalon i am using a keyword to connect my database, insert query and close connection. I am aware of this step and able to connect to database with katalon. But i am not very sure how to pass a dynamic value from ab.dbo.DOCUMENT table DOCUMENT_ID which it can randomly appear a number value to bc.dbo.DOCUMENT_IC table DOCUMENT_ID which i need to manually key in a value base on the value given.

    Below is my Katalon script:-

enter image description here

Hopefully someone can help me on this Thank you.

1 Answers1

0

If I have a table with an auto incrementing ID in one table and I need that value elsewhere I would typically write sql like this :

insert into firsttable (Document_Type) values ('PDF');

insert into secondtable (Document_ID, App_ref_Num) values (@@Identity, 'somenumber')

In the databases I have worked with @@Identity will give you the integer or id of the last inserted row. If you can't run multiple statements most connection libraries will have something like a $conn->insert_id that will do the same thing as running select @@identity.