SQL: insert a row and return the primary key value
Posted: Sat May 06, 2017 9:18 am
I have a MFT project that inserts data to a Postgresql table.
The table is defined with a primary key using an auto-increment column.
Example:
Rick
The table is defined with a primary key using an auto-increment column.
Example:
Code: Select all
The insert statement has a "returning" clause to return the value of the tracking_id field after the insert is complete:
CREATE TABLE tracker
(
tracking_id serial,
filename varchar(100),
)
Code: Select all
I would like to use the trackind_id value us subsequent steps in the MFT project. How do I capture the tracking_id value?insert into public.tracker
(tracking_id,filename)
values (default,${tempchuScratch})
returning tracking_id;
Rick