Re: SQL Help - Obtaining ID of record INSERTED - Mailing list pgsql-admin

From Ben Kim
Subject Re: SQL Help - Obtaining ID of record INSERTED
Date
Msg-id Pine.GSO.4.10.10508161748100.16844-100000@coe.tamu.edu
Whole thread Raw
In response to SQL Help - Obtaining ID of record INSERTED  ("josh@segrestfarms.com" <josh@segrestfarms.com>)
List pgsql-admin
You got the suggestion using currval already so here's one alternative.

    SELECT NEXTVAL('"orderid_sequence_name"');

Assume this value is $val then do

    INSERT INTO orderstemp(orderid,...) VALUES ($val, ...);

I'm not sure if this is generally used, but this works and sometimes this
way is convenient for batch processing.

>SELECT @@identity as orderid

My 0.02$.

Regards,

Ben Kim
Developer
College of Education
Texas A&M University


pgsql-admin by date:

Previous
From: Tom Lane
Date:
Subject: Re: Help with function
Next
From: Tom Lane
Date:
Subject: Re: Restore from pg_dumpall