Re: Obtaining the primary key of the record just inserted

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: Obtaining the primary key of the record just inserted
Дата
Msg-id dcc563d10711081003o515df294mdbf2b3bde2fe6b85@mail.gmail.com
обсуждение исходный текст
Ответ на Obtaining the primary key of the record just inserted  ("Oliveiros Cristina" <oliveiros.cristina@marktest.pt>)
Список pgsql-sql
On Nov 8, 2007 11:56 AM, Oliveiros Cristina
<oliveiros.cristina@marktest.pt> wrote:
>
> Hello, All,
>
> I have the need to know the primary key assigned to a record I've just
> INSERTed .
>
> Is there an easy way to solve this ?
>
> Similar to SQLServer's  SELECT scope_identity() ; ?

In 8.2 and up:

insert into table a (info) values ('abc') returning id;


В списке pgsql-sql по дате отправления:

Предыдущее
От: "Oliveiros Cristina"
Дата:
Сообщение: Obtaining the primary key of the record just inserted
Следующее
От: "Oliveiros Cristina"
Дата:
Сообщение: Re: Obtaining the primary key of the record just inserted