Page 1 of 1

SQL: insert a row and return the primary key value

Posted: Sat May 06, 2017 9:18 am
by rickc
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:
Code: Select all
CREATE TABLE tracker
(
  tracking_id serial,
  filename varchar(100),
)
The insert statement has a "returning" clause to return the value of the tracking_id field after the insert is complete:
Code: Select all
insert into public.tracker
(tracking_id,filename)
values (default,${tempchuScratch})
returning tracking_id;
I would like to use the trackind_id value us subsequent steps in the MFT project. How do I capture the tracking_id value?


Rick