Re: SQL Help - Obtaining ID of record INSERTED

Поиск
Список
Период
Сортировка
От Ben Kim
Тема Re: SQL Help - Obtaining ID of record INSERTED
Дата
Msg-id Pine.GSO.4.10.10508161748100.16844-100000@coe.tamu.edu
обсуждение исходный текст
Ответ на SQL Help - Obtaining ID of record INSERTED  ("josh@segrestfarms.com" <josh@segrestfarms.com>)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Help with function
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Restore from pg_dumpall